SQL Update

Results 1 to 2 of 2

Thread: SQL Update

  1. #1
    Join Date
    Dec 1969

    Default SQL Update

    This is the first time using SQL to Insert data into a table with ASP. I am used to the recordset object. I have read through many of the FAQ&#039;s and other postings, but this error doesn&#039;t seem to match any that others are having. Here is my Update section of the code.<BR><BR>-------START CODE SEGMENT---------------------------------<BR><BR>dim strConn<BR>strConn = "Provider=Microsoft.jet.oledb.4.0; Data source=d:cis480pestwebdatabasepestv2.mdb;Persist Security Info=False" <BR><BR>dim objRec, strSQL<BR>set objRec = server.createobject("ADODB.Recordset")<BR><BR>objR ec.open strConn &#060;--------------ERROR HAPPENS HERE<BR><BR>strSQL= "INSERT INTO Student(Stu_ID, Stu_LName, Stu_FName,"<BR>strSQL=strSQL & " Stu_Term, Stu_Section, Stu_Email, Stu_Add_Date)" <BR>strSQL=strSQL & "Values(" & strStuID & "," & strStuLName & "," <BR>strSQL=strSQL & strStuFName & "," & strStuTerm & "," <BR>strSQL=strSQL & strStuSection & "," <BR>strSQL=strSQL & strEmail & "," <BR>strSQL=strSQL & strAddDate & ")"<BR>objRec.execute strSQL<BR><BR>------------END OF CODE SEGMENT-----------------------------------<BR><BR>Here is the error # and description...<BR><BR>ADODB.Recordset error &#039;800a0e7d&#039; <BR><BR>Operation is not allowed on an object referencing a closed or invalid connection. <BR><BR>The wierd thing about this is that the connection string I use here (I use it in an include statement) works fine for every other page in the site, and it also works fine when I use a recordset object in this same code (But the program errors out for a diff. reason using the recordset object, this is why I was told to try a SQL statement to insert). I don&#039;t believe this matters, but the code segment from above is in a sub procedure. If anyone has any suggestions I would appreciate them greatly. -Matt<BR>

  2. #2
    Ghose Guest

    Default RE: SQL Update

    Try this... (the rows with an *)<BR><BR>dim strConn<BR><BR>*Set DBConnection = Server.CreateObject("adodb.connection") <BR>strConn = "Provider=Microsoft.jet.oledb.4.0; Data source=d:cis480pestwebdatabasepestv2.mdb;Persist Security Info=False" <BR>*DBConnection.Open strConn

Posting Permissions

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