Help (Insert a record to Access)

Results 1 to 2 of 2

Thread: Help (Insert a record to Access)

  1. #1
    Join Date
    Dec 1969

    Default Help (Insert a record to Access)

    I was trying to insert a record to Access but failed. Here are my code and the error message. Please help. Many thanks. I do know the problem is &#039;adLockOptimistic&#039; but dont know how to fix it.<BR><BR>Code<BR>***********************<BR>&#06 0;%@ Language=VBScript %&#062;<BR>&#060;% Option Explicit %&#062;<BR><BR>&#060;%<BR> Dim objConn<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.ConnectionString="DRIVER={Microsoft Access Driver (*.mdb)};" & _<BR> "DBQ=C:Inetpubwwwrootdatabasedb.mdb"<BR> objConn.Open<BR><BR> Dim objRS<BR> Dim adCmdTable<BR> Dim adLockOptimistic<BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.Open "Degree",objConn,,adLockOptimistic,adCmdTable<BR>< BR> objRS.AddNew<BR> objRS("DegreeCode") = "6"<BR> obJRS("DegreeName") = "Programming"<BR> objRS("DepNo") = "8"<BR> objRS.Update<BR> ojbRS.MoveFirst<BR><BR> Do While Not objRS.EOF<BR> Response.Write objRS("DegreeCode")<BR> Response.Write objRS("DegreeName")<BR> Response.Write objRS("DepNo")<BR> objRS.MoveNext<BR> Loop<BR><BR> objRS.Close<BR> Set objRS = Nothing<BR> <BR> objConn.Close<BR> Set objConn = Nothing<BR>%&#062;<BR><BR><BR>Error message<BR>*****************<BR>Error Type:<BR>ADODB.Recordset (0x800A0BB9)<BR>Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.<BR>/guestbook.asp, line 15<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default No need to crosspost

    Your answer is in the ASP forum.

Posting Permissions

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