hi
here is my script
this is the problematic part : I want to open an ordered recordset with the group by clause, if I do the following, i get a message : The recordset is not updatable"
this works but i can't control the order of records
please tell me if it's the right forum for this post
here is my script
Code:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
' 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
'---- LockTypeEnum Values ----
Const adLockReadOnly = 1
Const adLockPessimistic = 2
Const adLockOptimistic = 3
Const adLockBatchOptimistic = 4
dim intCounter
' Instantiate the ADO objects.
set mySourceConn = CreateObject("ADODB.Connection")
set mySourceRecordset = CreateObject("ADODB.Recordset")
mySourceConn ="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=true;Initial Catalog=Boehringer;Data Source=BRUSSQL03"
'mySQLCmdText = "Select * from tbltempmkt order by total_values"
mySourceRecordset.Open "Select * from tbltempmkt", mySourceConn, adOpenKeyset,adLockOptimistic
mySourceRecordset.MoveFirst
intCounter = 1
do while not mySourceRecordset.eof
if mySourceRecordset.Fields("total_values") = 0 then
mySourceRecordset.Fields("rank") = -1
else
mySourceRecordset.Fields("rank") = intCounter
end if
mySourceRecordset.update
intCounter = intCounter + 1
mySourceRecordset.MoveNext
loop
mySourceRecordset.Close
set mySourceRecordset = nothing
Main = DTSTaskExecResult_Success
End Function
this is the problematic part : I want to open an ordered recordset with the group by clause, if I do the following, i get a message : The recordset is not updatable"
Code:
mySQLCmdText = "Select * from tbltempmkt order by total_values"
mySourceRecordset.Open mySQLCmdText,
this works but i can't control the order of records
Code:
mySourceRecordset.Open "Select * from tbltempmkt",
please tell me if it's the right forum for this post