Hi Sean,
You are opening in the wrong way...here is an example :
JFB
'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************
Function Main()
Dim countr
' Connection to SQL
set mySourceConn=CreateObject("ADODB.Connection")
set mySourceRecordset=CreateObject("ADODB.Recordset")
mySourceConn.Open="Provider=SQLOLEDB;Trusted_Conne ction=yes; Data
Source=ServerName; Initial Catalog=Northwind; user id='user';
password='pwd'"
mySQLCmdText= "select orderID from orders"
mySourceRecordset.open mySQLCmdText, mySourceConn
msgbox mySQLCmdText
msgbox mySourceRecordset.RecordCount
If IsNull(mySourceRecordset.EOF) or (mySourceRecordset.cachesize < 1)
Then
num=1
Else
For countr =1 to mySourceRecordset.RecordCount
num=mySourceRecordset.Fields("orderID").value
mySourceRecordset.MoveNext
Next
End if
mySourceRecordset.close
Main = DTSTaskExecResult_Success
End Function
"Sean" <seanmccown (AT) srcp (DOT) com> wrote
Quote:
what's wrong with this script...
I get an error of 'data source name not found and no
default driver specified'
any suggestions... thanks.
set oConn = CreateObject("ADODB.RecordSet")
svr = "Provider=SQLOLEDB;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=master;Data Source=
(local)"
SQLTxT = "select * from sysdatabases"
oConn.Open svr, SQLTxT
While NOT oConn.EOF
msgbox oConn.fields("Name")
Wend
oConn.Close
set oConn = nothing |