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!

Cursor error in my code :-(

Status
Not open for further replies.

Debeast

Programmer
Jul 18, 2002
28
0
0
GB

i get this error when i try to add a new record to a table in a mysql data base i haven't got a clue what it means :(

--------------------------------
Microsoft Cursor Engine error '80040e21'

Multiple-step operation generated errors. Check each status value.

/signup2.asp, line 131
----------------------------

This is my code
-------------------
Set RSpass = server.createobject("ADODB.recordset")
RSpass.open "passes",conn,1,3,2
RSpass.addnew
RSpass(&quot;username&quot;) = request.form(&quot;Username&quot;) <-this is line 131

RSpass(&quot;Password&quot;) = myPassword

RSpass(&quot;firstname&quot;) = request.form(&quot;firstname&quot;)

RSpass(&quot;surname&quot;) = request.form(&quot;surname&quot;)

RSpass(&quot;email&quot;) = request.form(&quot;email1&quot;)


RSpass(&quot;GROUPS&quot;) = &quot;EVERYONE&quot;

RSpass.update
RSpass.close
'----------------------

and the request object isn't empty before you ask :) oh and heres the code for my conn object

'----------------------------------
Session.timeout = 5
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
DSNtemp = &quot;DRIVER={MySQL};SERVER=demweb;UID=root;DATABASE=OCDEM&quot;
conn.open DSNTemp
Set Session(&quot;MyDB_conn&quot;) = conn
conn.cursorlocation = 3
'-----------------------------------

if anybody could help i'd really appreciate it .

Thanks Guys
 
Can you try this:
conn.execute &quot;INSERT [passes] ([username],[Password],[firstname],[surname],,[GROUPS]) VALUES ('&quot; & request.form(&quot;Username&quot;) & &quot;','&quot; & myPassword & &quot;','&quot; & request.form(&quot;firstname&quot;) & &quot;','&quot; & request.form(&quot;surname&quot;) & &quot;','&quot; & request.form(&quot;email1&quot;) & &quot;','&quot;EVERYONE')&quot;

It might be a good idea not to use any ' in any of the textboxes as these are not replaced with '' so the sql string will not be correct. Either replace all ' in any textfield with '' or fill out '' where you need '.
 
i now get the error.

Microsoft OLE DB Provider for ODBC Drivers error '80040e09'

[TCX][MyODBC]You have an error in your SQL syntax near '[passes] ([Username],[Userpass],[Firstname],[Surname],,[Groups]) VALUES (' at line 1

/signup2.asp, line 128


:-(

any ideas why that codes wrong ?
 
never mind i've corrected your code and it works

code:
---------------------------
conn.execute &quot;INSERT into passes (Username,Userpass,Firstname,Surname,Email,Groups) VALUES ('&quot; & request.form(&quot;Username&quot;) & &quot;','&quot; & myPassword & &quot;','&quot; & request.form(&quot;Firstname&quot;) & &quot;','&quot; & request.form(&quot;Surname&quot;) & &quot;','&quot; & request.form(&quot;Email1&quot;) & &quot;','EVERYONE')&quot;
'------------------------------

So thanks mate any idea why the other code doesn't work though?>>>???>??

or is it one of those unsolvable mysteries like how come all belly button fluff if grey even if you never wear grey?
 
Hmm, I tested the sql statement with SQL server 2000 not mySQL.
I don't know if the insert into is mandatory.
And if the [] is consistent with the SQL dialect used by mySQL.

Glad you got it working anyway but be careful about the '
The following function should take care of those pescy ' but I haven't tested it yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top