April 28, 2005 at 8:05 am
hi
here is the code that tries to access a table and update some values.
CODE
' These values were copied from the ADOVBS.INC file.
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adOpenStatic = 3
'---- CommandTypeEnum Values ----
Const adCmdUnknown = &H0008
Const adCmdText = &H0001
Const adCmdTable = &H0002
Const adCmdStoredProc = &H0004
dim intCounter
' Instantiate the ADO objects.
set mySourceConn = CreateObject("ADODB.Connection")
set mySourceRecordset = CreateObject("ADODB.Recordset")
mySourceConn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=XponentData;Data Source=MyServer"
mySQLCmdText = "Select * from tblTemp ORDER BY Rx"
'Execute the mySQLCmdText, and put the data into the myRecordset object.
mySourceRecordset.Open mySQLCmdText, mySourceConn, adOpenKeyset
If mySourceRecordset.RecordCount < 1 Then
MsgBox " There are no records found. Return a Failure code"
Main = DTSTaskExecResult_Failure
Else
mySourceRecordset.MoveFirst
for intCounter = 1 to mySourceRecordset.RecordCount
mySourceRecordset.Fields("rank") = intCounter
mySourceRecordset.Update
mySourceRecordset.MoveNext
Next
Main = DTSTaskExecResult_Success
End If
I throws the following error :
Current Recordset does not support updating.This may be a limitation of the provider , or of the selected locktype.
Any ideas ?
thanks
April 28, 2005 at 9:32 am
i solved it by adding adLockOptimistic to the Open statement
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply