dbTalk Databases Forums  

Re: ActiveX Connection...

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: ActiveX Connection... in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Narayana Vyas Kondreddi
 
Posts: n/a

Default Re: ActiveX Connection... - 08-12-2003 , 11:35 AM






Looks like you are passing the parameters to oConn.open the wrong way
around.
--
HTH,
Vyas, MVP (SQL Server)
http://vyaskn.tripod.com/
What hardware is your SQL Server running on?
http://vyaskn.tripod.com/poll.htm


"Sean" <seanmccown (AT) srcp (DOT) com> wrote

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



Reply With Quote
  #2  
Old   
JFB
 
Posts: n/a

Default Re: ActiveX Connection... - 08-13-2003 , 09:04 AM






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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.