Inserting Values- - can someone pls explain what t

Results 1 to 2 of 2

Thread: Inserting Values- - can someone pls explain what t

  1. #1
    gautan Guest

    Default Inserting Values- - can someone pls explain what t

    I am reading a html form. The form has only 1 text field. It is this text field that needs to be inserted in the access database.<BR>Everytime I try to execute an Insert Statement I get the Following Error:<BR><BR>ADODB.Command error &#039 800a0bb9&#039 <BR><BR>The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another. <BR><BR>/gautam/final.asp, line 20 <BR><BR><BR>This is the script that generates this error:<BR><BR>&#060;%<BR>DIM ConObj<BR>DIM RSObj<BR>DIM SQL<BR>Set ConObj=Server.CreateObject("ADODB.connection")<BR> &#039Set RSObj=Server.CreateObject("ADODB.recordset")<BR>Se t ObjCmd=Server.CreateObject("ADODB.Command")<BR>&#0 39ConObj.ConnectionString ="Driver={Microsoft Access Driver(*.mdb)};DBQ=C:Gautam rial.mdb"<BR>ConObj.Open "DRIVER={Microsoft Access Driver (*.mdb)};" & _<BR>"DBQ=C:Gautam rial.mdb;" & _<BR>"UID=Admin pwd=;" <BR>firstn = CStr(Request.Form("first_name"))<BR>&#039lastname= Request.Form("last_name")<BR>ObjCmd.ActiveConnecti on = ConObj<BR><BR>ObjCmd.CommandText = "Insert INTO name (fname) Values (firstn);"<BR>ObjCmd.CommandType = adCmdText<BR>ObjCmd.Execute <BR>Set ObjCmd=Nothing<BR>ObjCmd.close<BR>Set ConObj=Nothing<BR>ConObj.Close <BR>%&#062;<BR><BR>Also If I comment out the Command Object<BR>Commandtype property then the error message changes to<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e10&#039 <BR><BR>[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. <BR><BR>/gautam/final.asp, line 21 <BR><BR><BR>I am using a simple access database which is called trial and has just a single table call name. The name table has just 2 fields which are described as follows<BR>fname: lenght 20 type text<BR>primary :Autonumber and it is the <BR>primary key for the table<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Inserting Values- - can someone pls explain wh

    I have never saw it done this commandtext way, but I might have an idea of what might be wrong. Try this..<BR><BR>"Insert INTO name (fname) Values ("&#039" & firstn & "&#039");"<BR><BR>I think you need to have single quotes around your variable so that the database knows its a string value and you won&#039t get a type mismatch error.<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts