# Error Type: ADODB.Recordset (0x800A0E7D)



## Urgent (Aug 11, 2004)

Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/1stsite/AddSheet.asp, line 31

I just don't get this one, here's the code:

Form After Adding A Consultant

* New Consultant *


<%
Dim strFirstName
Dim strLastName
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")

Response.Write "Mr/Mrs "
Response.Write strFirstName
Response.Write " "
Response.Write strLastName
Response.Write " has been added to the database.

Database contents:

"

Dim adOpenForwardOnly, adLockReadOnly, adLockOptimistic, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adLockOptimistic = 3
adCmdTable = 2

Dim objConn, objRS, intIDForNewRecord
set objConn = server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open "Consultants", objConn, adOpenForwardOnly, adLockOptimistic, adCmdTable
objRS.MoveLast
intIDForNewRecord = objRS("ID") + 1
objRS.AddNew
objRS("MovieID") = intIDForNewRecord
objRS("FirstName") = strFirstName
objRS("LastName") = strLastName
objRS.Update
objRS.Close

objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;"&_
"Data Source=C:\MYDB.mdb;"&_
"Persist Security Info=False"

objRS.Open "Consultants", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

Response.Write objRS("FirstName") & objRS("Lastname")

While Not objRS.EOF
Response.Write objRS("FirstName") & objRS("Lastname") & "
"
objRS.MoveNext
Wend
%>

Any Help?


----------



## Urgent (Aug 11, 2004)

Ok, Ignore ALL that crap, I've sorted it and I was just being stupid


----------

