ROM
asked on
Microsoft Cursor Engine error '80040e21'
Hi, I keep getting this error:
Microsoft Cursor Engine error '80040e21'
Multiple-step operation generated errors. Check each status value.
I know this error generally appears when trying to enter too much data into a field that hasn't been set big enough.
The code generating the error is below. It appears on the line:
transactionRS("transaction Item") = serviceName
it is trying to enter some data into a MySQL database, the datatype for the filed is VARCHAR(255) but serviceName is a maximum of 20 characters
any suggestions?
Microsoft Cursor Engine error '80040e21'
Multiple-step operation generated errors. Check each status value.
I know this error generally appears when trying to enter too much data into a field that hasn't been set big enough.
The code generating the error is below. It appears on the line:
transactionRS("transaction
it is trying to enter some data into a MySQL database, the datatype for the filed is VARCHAR(255) but serviceName is a maximum of 20 characters
any suggestions?
transactionRS.AddNew
transactionRS("transactionItem") = serviceName
transactionRS.Update
ASKER
here you go:
Set transactionRS = Server.CreateObject("ADODB.Recordset")
transactionQuery = "Select * FROM transactions"
transactionRS.Locktype = 3
transactionRS.CursorLocation = 3
transactionRS.Open transactionQuery, insertConnect
Ok, that's working fine for me, data is inserted into database:
<%
serviceName = "My service " & Now()
insertConnect = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=password"
Set transactionRS = Server.CreateObject("ADODB.Recordset")
transactionQuery = "Select * FROM transactions"
transactionRS.LockType = 3
transactionRS.CursorLocation = 3
transactionRS.Open transactionQuery, insertConnect
transactionRS.AddNew
transactionRS("transactionItem") = serviceName
transactionRS.Update
transactionRS.Close
Set transactionRS = Nothing
response.write "Done! " & Now()
%>
ASKER
that's what I thought. It's totally confusing me as it seems to work sometimes but not others.
for the following serviceName cases it works
Swap Shop
Stylefile
but for these it doesn't:
Wardrobe Rehab
Delux Wardrobe Rehab
You can see that these are larger strings but it's writing to a field with a datatype of varchar(255)
for the following serviceName cases it works
Swap Shop
Stylefile
but for these it doesn't:
Wardrobe Rehab
Delux Wardrobe Rehab
You can see that these are larger strings but it's writing to a field with a datatype of varchar(255)
The values I tested to be inserted into database certainly are longer than "Delux Wardrobe Rehab" and without any problems.
alternatively, you may try use an Insert SQL statement instead, just in case you can't figure it out and you run out of time... like below:
alternatively, you may try use an Insert SQL statement instead, just in case you can't figure it out and you run out of time... like below:
<%
serviceName = "My service " & Now()
insertConnect = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=password"
Set conn = Server.CreateObject("ADODB.Connection")
conn.open insertConnect
v = Replace(serviceName,"'","''")
SQL = "Insert into transactions (transactionItem) Values ('" & v & "')"
conn.execute SQL
conn.close
set conn = nothing
response.write "Done! " & Now()
%>
ASKER
ok, tried that. The code below is the actual code in the page.
I've put a Response.Write statement in there to view the generated sql string and it produces valid SQL:
INSERT INTO transactions (date,TxCode,transactionIt em,clientI d) VALUES ('07-04-2009 16:12:18','stylefile070420 09091','Sw ap Shop Points','3')
But I get the following error:
Microsoft VBScript runtime error '800a01a8' Object required: '' /protx/buyservice.asp, line 300
line 300 is the line with transactionsRS.execute SQL
I've put a Response.Write statement in there to view the generated sql string and it produces valid SQL:
INSERT INTO transactions (date,TxCode,transactionIt
But I get the following error:
Microsoft VBScript runtime error '800a01a8' Object required: '' /protx/buyservice.asp, line 300
line 300 is the line with transactionsRS.execute SQL
SQL = "INSERT INTO transactions (date,TxCode,transactionItem,clientId) VALUES ('" & dateNow & "','" & VendorTxCode & "','" & serviceName & "','" & clientSet__MMColParam & "')"
Response.Write(SQL)
transactionsRS.execute SQL
>>transactionsRS.execute SQL
?
is transactionsRS an ADODB.Connection object?
please try amend using the scripts posted @ ID:24078554
?
is transactionsRS an ADODB.Connection object?
please try amend using the scripts posted @ ID:24078554
ASKER
Your right, i had it set as the wrong object.
Here's the new full code
MM_sfasp_STRING is the connection string
Here's the new full code
MM_sfasp_STRING is the connection string
Dim insertConnect, transactionRS
Set transactionRS = Server.CreateObject("ADODB.Connection")
insertConnect = MM_sfasp_STRING
transactionRS.Open insertConnect
Dim dateNow, SQL
dateNow = Replace(now,"/","-")
SQL = "INSERT INTO transactions (date,TxCode,transactionItem,clientId) VALUES ('" & dateNow & "','" & VendorTxCode & "','" & serviceName & "','" & clientSet__MMColParam & "')"
Response.Write(SQL)
transactionsRS.execute SQL
ASKER
whoops, forgot to say that it's still producing the same error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
genius, thanks I know it would be something like that. thank you
transactionRS.AddNew
?
make sure you open your recordset is writable?
like:
transactionRS.open yourSQL, conn, 3, 3
?