write back records?

Results 1 to 2 of 2

Thread: write back records?

  1. #1
    Join Date
    Dec 1969

    Default write back records?

    Hi. I have a Select statement, and I would like to write back the result records in a format w/ the listing of the Field name, and then the result from the db. However, I got the following error: The connection cannot be used to perform this operation. It is either closed or invalid in this context. <BR><BR>This is referring to the line: RS.Open "SELECT * FROM MoveInfo WHERE MoveId= " & iMoveId<BR><BR>My code is as follow: <BR>iMoveId=Cint(Request.QueryString("MoveId")) <BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>objConn .Open "DSN=EmployeeMove;UID=sa;PWD=;"<BR>Set RS = Server.CreateObject("ADODB.RecordSet")<BR>RS.Open "SELECT * FROM MoveInfo WHERE MoveId= " & iMoveId<BR>Do Until RS.EOF = True<BR> Response.Write "First Name:" & RS("fname")<BR> Response.Write "Last Name:" & RS("lname")<BR>RS.MoveNext<BR>Loop<BR>RS.Close<BR> Set RS=Nothing<BR>objConn.Close<BR>Set objConn = Nothing<BR><BR>Please help! Thanks!

  2. #2
    Join Date
    Dec 1969

    Default use your connection

    looks like you didn&#039;t add your connection:<BR><BR>Which line is it failing?<BR><BR>SQLstmt = "SELECT * FROM MoveInfo WHERE MoveId= " & iMoveId <BR><BR>RS.Open SQLstmt, objConn<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