Connecting to SQL server using Access 97.

G

Guest

I'm having trouble connecting to SQL server using a dsn-less connection. I have used to code before, and have experienced no problems before, but now when I run the code, it connects to the SQL server. However, if I come out of the access database, and go back in, it attempts to connect to these tables using a trusted connection. This is causing a dialogue box to appear, when I attempt to run a query against the SQL tables
The code I use to connect is as follows

MyTableDef.Connect = "ODBC;APP=Microsoft® Access;DRIVER={SQL SERVER};SERVER=" & gSQLserver & ";UID=" & gSQLuid & ";PWD=" & gSQLpwd & ";DATABASE=" & gSQLdb & ";TABLE=dbo." & SQLTableName & ";DSN=''

all of the parameters that are required have been set, and it would surely fail to connect to the SQL server if the info in here was incorrect the first time round

Any ideas??
 
M

MGFoster

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You connection string is for a TABLE. It is not a general connection.
Check the SQL Server to see if it logs a user using NT Logon info or
SQL Server logon. Your connection string is for SQL Server logons.
If the SQL'r is set up to use NT Logons remove the UID & PWD
parameters and substitute Trusted_Connection=Yes parameter.

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQDFy+4echKqOuFEgEQI8mACfWETkHl2atz9damyQWhwYPnKaR4QAoMbi
/Rv24gJRdQxb0TYxGyM4vUGU
=oZnr
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top