Connecting to SQL 
Author Message
 Connecting to SQL

Hi,

I'm trying to create a exe file in VB to run with the logon script which
will connect to Sql server and add details of the users PC.  This I have
managed using a DSN ODBC connection.  However I need to be able to run this
file with the logon script, and none of the PC's have the Sql server ODBC
connection set up!  How can I create a connection to my SQL server in a way
I can run this VB executable on any PC (mainly XP, but some W2k and NT4)?

Many Thanks

John



Mon, 09 May 2005 22:12:06 GMT  
 Connecting to SQL
John-

Look at the HKLM\Software\ODBC\ODBC.INI key on the working box to get the
DSN

Then you can either write script to change the entries or use a .reg file to
import them.

I've also seen where you can use a full connect string instead of using DSN
entries as well.

HTH

Matt


Quote:
> Hi,

> I'm trying to create a exe file in VB to run with the logon script which
> will connect to Sql server and add details of the users PC.  This I have
> managed using a DSN ODBC connection.  However I need to be able to run
this
> file with the logon script, and none of the PC's have the Sql server ODBC
> connection set up!  How can I create a connection to my SQL server in a
way
> I can run this VB executable on any PC (mainly XP, but some W2k and NT4)?

> Many Thanks

> John



Tue, 10 May 2005 00:34:44 GMT  
 Connecting to SQL
I have managed to sort it, I think, by scouring many websites for sample
code. Phew. But the idea for importing registry entries is useful to know.

Cheers

Quote:
> John-

> Look at the HKLM\Software\ODBC\ODBC.INI key on the working box to get the
> DSN

> Then you can either write script to change the entries or use a .reg file
to
> import them.

> I've also seen where you can use a full connect string instead of using
DSN
> entries as well.

> HTH

> Matt



> > Hi,

> > I'm trying to create a exe file in VB to run with the logon script which
> > will connect to Sql server and add details of the users PC.  This I have
> > managed using a DSN ODBC connection.  However I need to be able to run
> this
> > file with the logon script, and none of the PC's have the Sql server
ODBC
> > connection set up!  How can I create a connection to my SQL server in a
> way
> > I can run this VB executable on any PC (mainly XP, but some W2k and
NT4)?

> > Many Thanks

> > John



Tue, 10 May 2005 00:58:56 GMT  
 Connecting to SQL
You can try an DSNless ado connection like:

conn.Open
"Provider=sqloledb;server=mysqlserver;uid=sa;pwd=ok;database=pubs;"

or:

conn.Open "Driver={SQL
SERVER};server=mysqlserver;uid=sa;pwd=ok;database=pubs;"

Luke

(This posting is provided "AS IS", with no warranties, and confers no
rights.)



Wed, 11 May 2005 21:46:12 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using Vbscript and SQL-DMO to connect to SQL Server and run a T-SQL script

2. connect to sql server through sql-dmo

3. error with access project adp- connecting to sql

4. Connect to SQL Server

5. Trouble connecting to sql server using DSN

6. Trouble connecting to SQL Server 7 via Access Project

7. Custom error messages Connecting to SQL 7.0 Through Access 97

8. DAO - Connect to SQL Server via ODBC

9. Connecting to SQL

10. using vba to connect to sql database

11. automation error connecting to SQL

12. Connecting to SQL 7 for Mail Merge

 

 
Powered by phpBB® Forum Software