Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error reading ADO recordset.open

Status
Not open for further replies.

mmarkym

Programmer
Mar 23, 2002
54
0
0
US
I have a database query to insert records but am getting this error message.

Error Type:
ADODB.Recordset.1 (0x800A0E79)
Invalid operation on open object

The code reads as follows.

bug = 0

strFname = request.form("fname")
strLname = request.form("lname")
strStreet = request.form("street")
strCity = request.form("city")
strState = request.form("state")
intZip = request.form("zip")
'intPhone = request.form("phone")
intNum = request.form("number")
intTime = request.form("time")
intDate = request.form("date")
strEmail = request.form("email")

set objConn = server.createobject("ADODB.connection")

set objRS = server.createobject("ADODB.recordset")

strConnectionString = "Driver={mySQL}; Server=localhost; Port=3306; Option=0; Socket=; Stmt=; Database=my dabasename; Uid=username; Pwd=password;"

objConn.open strConnectionString

objRS.Open "Reservations", objConn, 3, 3

objRS.AddNew

objRS("fname") = strFname
objRS("lname") = strLname
objRS("street") = strStreet
objRS("city") = strCity
objRS("state") = strState
objRS("zip") = intZip
'objRS("phone") = intPhone
objRS("number") = intNum
objRS("time") = intTime
objRS("date") = intDate
objRS("email") = strEmail

objRS.update
 
Try
objRS.Open "select top 1 * from Reservations", objConn, 3, 3


________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Now I get this error.

Error Type:
ADODB.Recordset.1 (0x80004005)
SQLState: 42000 Native Error Code: 1064 [TCX][MyODBC]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1 * from Reservations' at line 1
 
Ah, i see you are using MySql then it should work this way
objRS.Open "select * from Reservations limit 0,1", objConn, 3, 3


________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Why this?

Error Type:
ADODB.Recordset.1 (0x80004005)
Recordset is read-only
 
Weird, anyway you should check your documentation from Program Files/MyOLEDB directory and look for example there.
My code should work but as i see from myOLEDB directory you could need something else.

________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top