dbTalk Databases Forums  

Useing a connection object in an activex control

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


Discuss Useing a connection object in an activex control in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ben
 
Posts: n/a

Default Useing a connection object in an activex control - 06-29-2005 , 11:19 AM






Hello, I have a connection object created called "connection 2" that connects
with the user name and password to the proper database. I am tring to do the
following:
set objCnn =
DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM SpamLogs", objCnn,
adOpenKeyset, adLockOptimistic

but its not working, i get an arguments of the wrong time with the recordset
opening.

i also tried the following:
set objADOCnn = CreateObject("ADODB.Connection")
set objCnn = DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")

objADOCnn.Provider="sqloledb"
objADOCnn.Properties("Initial Catalog")=objCnn.Catalog
objADOCnn.Properties("Data Source")=objCnn.Datasource
objADOCnn.Properties("User ID") = objCnn.UserId
objADOCnn.Properties("Password") = objCnn.Password
'objADOCnn.Properties("Database") = objCnn.Database
objADOCnn.Open

objADORS.Open "SELECT * FROM SpamLogs", objADOCnn, adOpenKeyset,
adLockOptimistic

but this fails on the .open command. (i belive its not getting the
password). Any suggestions?

Thanks



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Useing a connection object in an activex control - 06-29-2005 , 12:51 PM






You cannot use connections in this way. You could rip the details from a
connection and use that in your ADO code though

(except for the password property if used)

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Ben" <ben_1_ AT hotmail DOT com> wrote

Quote:
Hello, I have a connection object created called "connection 2" that
connects
with the user name and password to the proper database. I am tring to do
the
following:
set objCnn =
DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM SpamLogs", objCnn,
adOpenKeyset, adLockOptimistic

but its not working, i get an arguments of the wrong time with the
recordset
opening.

i also tried the following:
set objADOCnn = CreateObject("ADODB.Connection")
set objCnn = DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")

objADOCnn.Provider="sqloledb"
objADOCnn.Properties("Initial Catalog")=objCnn.Catalog
objADOCnn.Properties("Data Source")=objCnn.Datasource
objADOCnn.Properties("User ID") = objCnn.UserId
objADOCnn.Properties("Password") = objCnn.Password
'objADOCnn.Properties("Database") = objCnn.Database
objADOCnn.Open

objADORS.Open "SELECT * FROM SpamLogs", objADOCnn, adOpenKeyset,
adLockOptimistic

but this fails on the .open command. (i belive its not getting the
password). Any suggestions?

Thanks





Reply With Quote
  #3  
Old   
Ben
 
Posts: n/a

Default Re: Useing a connection object in an activex control - 06-29-2005 , 01:49 PM



Thanks Allan, but the reason I was attempting this is so the code doesnt have
to have the password coded in plain text. I guess since only admin and
authorized users can read the control it will be ok.
Is there any other way around it?

Ben

"Allan Mitchell" wrote:

Quote:
You cannot use connections in this way. You could rip the details from a
connection and use that in your ADO code though

(except for the password property if used)

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Ben" <ben_1_ AT hotmail DOT com> wrote in message
news72F7A11-AC54-4FAE-9C52-471778CF8B92 (AT) microsoft (DOT) com...
Hello, I have a connection object created called "connection 2" that
connects
with the user name and password to the proper database. I am tring to do
the
following:
set objCnn =
DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM SpamLogs", objCnn,
adOpenKeyset, adLockOptimistic

but its not working, i get an arguments of the wrong time with the
recordset
opening.

i also tried the following:
set objADOCnn = CreateObject("ADODB.Connection")
set objCnn = DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")

objADOCnn.Provider="sqloledb"
objADOCnn.Properties("Initial Catalog")=objCnn.Catalog
objADOCnn.Properties("Data Source")=objCnn.Datasource
objADOCnn.Properties("User ID") = objCnn.UserId
objADOCnn.Properties("Password") = objCnn.Password
'objADOCnn.Properties("Database") = objCnn.Database
objADOCnn.Open

objADORS.Open "SELECT * FROM SpamLogs", objADOCnn, adOpenKeyset,
adLockOptimistic

but this fails on the .open command. (i belive its not getting the
password). Any suggestions?

Thanks






Reply With Quote
  #4  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Useing a connection object in an activex control - 06-29-2005 , 02:03 PM



Not really. Why do you have the need to break out into ADO? Can DTS out of
the box not cut it?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Ben" <ben_1_ AT hotmail DOT com> wrote

Quote:
Thanks Allan, but the reason I was attempting this is so the code doesnt
have
to have the password coded in plain text. I guess since only admin and
authorized users can read the control it will be ok.
Is there any other way around it?

Ben

"Allan Mitchell" wrote:

You cannot use connections in this way. You could rip the details from a
connection and use that in your ADO code though

(except for the password property if used)

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Ben" <ben_1_ AT hotmail DOT com> wrote in message
news72F7A11-AC54-4FAE-9C52-471778CF8B92 (AT) microsoft (DOT) com...
Hello, I have a connection object created called "connection 2" that
connects
with the user name and password to the proper database. I am tring to
do
the
following:
set objCnn =
DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM SpamLogs", objCnn,
adOpenKeyset, adLockOptimistic

but its not working, i get an arguments of the wrong time with the
recordset
opening.

i also tried the following:
set objADOCnn = CreateObject("ADODB.Connection")
set objCnn = DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")

objADOCnn.Provider="sqloledb"
objADOCnn.Properties("Initial Catalog")=objCnn.Catalog
objADOCnn.Properties("Data Source")=objCnn.Datasource
objADOCnn.Properties("User ID") = objCnn.UserId
objADOCnn.Properties("Password") = objCnn.Password
'objADOCnn.Properties("Database") = objCnn.Database
objADOCnn.Open

objADORS.Open "SELECT * FROM SpamLogs", objADOCnn, adOpenKeyset,
adLockOptimistic

but this fails on the .open command. (i belive its not getting the
password). Any suggestions?

Thanks








Reply With Quote
  #5  
Old   
Ben
 
Posts: n/a

Default Re: Useing a connection object in an activex control - 07-01-2005 , 02:39 PM



The purpose of the script is to load xml files into a sql table. To connect
to the db, the script creates a connection and a record set that point to the
proper table. I was hoping that I didnt have to hardcode the password into
the connection string

"Allan Mitchell" wrote:

Quote:
Not really. Why do you have the need to break out into ADO? Can DTS out of
the box not cut it?

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new stuff.
www.konesans.com - Consultancy from the people who know


"Ben" <ben_1_ AT hotmail DOT com> wrote in message
news:3A6B9B8E-FDAE-4115-BF0C-3D1F13A3B78E (AT) microsoft (DOT) com...
Thanks Allan, but the reason I was attempting this is so the code doesnt
have
to have the password coded in plain text. I guess since only admin and
authorized users can read the control it will be ok.
Is there any other way around it?

Ben

"Allan Mitchell" wrote:

You cannot use connections in this way. You could rip the details from a
connection and use that in your ADO code though

(except for the password property if used)

--



Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - You thought DTS was good. here we show you the new
stuff.
www.konesans.com - Consultancy from the people who know


"Ben" <ben_1_ AT hotmail DOT com> wrote in message
news72F7A11-AC54-4FAE-9C52-471778CF8B92 (AT) microsoft (DOT) com...
Hello, I have a connection object created called "connection 2" that
connects
with the user name and password to the proper database. I am tring to
do
the
following:
set objCnn =
DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")
objADORS.Open "SELECT * FROM SpamLogs", objCnn,
adOpenKeyset, adLockOptimistic

but its not working, i get an arguments of the wrong time with the
recordset
opening.

i also tried the following:
set objADOCnn = CreateObject("ADODB.Connection")
set objCnn = DTSGlobalVariables.Parent.Connections("Connection 2")
Set objADORS = CreateObject("ADODB.Recordset")

objADOCnn.Provider="sqloledb"
objADOCnn.Properties("Initial Catalog")=objCnn.Catalog
objADOCnn.Properties("Data Source")=objCnn.Datasource
objADOCnn.Properties("User ID") = objCnn.UserId
objADOCnn.Properties("Password") = objCnn.Password
'objADOCnn.Properties("Database") = objCnn.Database
objADOCnn.Open

objADORS.Open "SELECT * FROM SpamLogs", objADOCnn, adOpenKeyset,
adLockOptimistic

but this fails on the .open command. (i belive its not getting the
password). Any suggestions?

Thanks









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.