Microsoft
Software
Hardware
Network
Question : Port from ACCESS to SQL Server throws ERRORS: Microsoft OLE DB Provider for ODBC Drivers error '80040e23' [Microsoft][ODBC SQL Server Driver]Cursor operation conflict
I have an .asp application that I moved from an MS Access backend to a SQL Server (MSDE verison) backend.
I'm now plagued with the following error anytime I have code that wants to do an rs.update
Microsoft OLE DB Provider for ODBC Drivers error '80040e23'
[Microsoft][ODBC SQL Server Driver]Cursor operation conflict ]
What gives? Why ok with Access and not SQL Server?
A sample of code that gives me such an error is:
If request.QueryString("Advis
orTo") <> "" Then
'Dim JobIdtoChange
Dim sqlString5
Dim newAdvisor
'Trouble Shooting --> Response.Write(request.Que
ryString("
JobId")) & "
" Response.Write(request.Que
ryString("
AdvisorTo"
))
JobIdtoChange = request.QueryString("JobId
")
sqlString5 = "select * from job where ID = " & JobIdtoChange
newAdvisor = request.QueryString("Advis
orTo")
'Open recordset
set rs = Server.CreateObject("ADODB
.Recordset
")
rs.Open sqlString5, "DSN=dsnname;UID=user;PWD=
password;D
B=database
_db;", adOpenDynamic, adLockOptimistic
rs("AdvisorID").value = newAdvisor
'Writes the record
rs.Update
'Closes the recordset
rs.Close
End If
Answer : Port from ACCESS to SQL Server throws ERRORS: Microsoft OLE DB Provider for ODBC Drivers error '80040e23' [Microsoft][ODBC SQL Server Driver]Cursor operation conflict
>>yes, I'd like to go that route. <<
If request.QueryString("Advis
orTo") <> "" Then
'Dim JobIdtoChange
Dim sqlString5
Dim newAdvisor
'Trouble Shooting --> Response.Write(request.Que
ryString("
JobId")) & "
" Response.Write(request.Que
ryString("
AdvisorTo"
))
JobIdtoChange = request.QueryString("JobId
")
sqlString5 = "select * from job where ID = " & JobIdtoChange
newAdvisor = request.QueryString("Advis
orTo")
'Open recordset
set rs = Server.CreateObject("ADODB
.Recordset
")
rs.CursorLocation = adUseClient ' Add this line
rs.Open sqlString5, "DSN=dsnname;UID=user;PWD=
password;D
B=database
_db;", adOpenDynamic, adLockOptimistic
rs("AdvisorID").value = newAdvisor
'Writes the record
rs.Update
'Closes the recordset
rs.Close
End If
>>I'm all for learning how to do it the 'right way', right now."<<
Try it this way:
Dim JobIdtoChange
Dim SQL
Dim newAdvisor
Dim cn
newAdvisor = request.QueryString("Advis
orTo")
If Len(newAdvisor) Then
JobIdtoChange = request.QueryString("JobId
")
'Open Connection
Set cn = Server.CreateObject("ADODB
.Connectio
n")
With cn
.ConnectionString = "DSN=dsnname;UID=user;PWD=
password;D
B=database
_db;"
.Open
' Assuming that AdvisorID and ID are numeric
SQL = "Update job Set AdvisorID = newAdvisor Where ID = " & JobIdtoChange
.Execute SQL, , 128 ' adExecuteNoRecords
.Close
End With
Set cn = Nothing
End If
Random Solutions
Invalid object name 'sysdatabases'.
how to delete or call back an email sent to all users
How to use klogd properly?
EX2k7SP1 Rollup #4: Ended Prematurely
unable to open, print, or save web based pdfs in IE7
Windows Server 2000 Decommission
Use stored procedure as dataset in SSRS
Outlook, 2002, Identities
Date/Time anomaly in CRM
Backup a server to a non windows NAS (Buffalo - TeraStation Pro II 2.0TB Network Attached Storage)