[AccessD] HELP! Access97 passthrough query to SQL

Developer Developer at UltraDNT.com
Wed Feb 4 19:38:38 CST 2004


Try qryDef.Connect = gOcon.Connection

Steve


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Jeanine Scott
Sent: Wednesday, February 04, 2004 8:23 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] HELP! Access97 passthrough query to SQL
Importance: High


Anyone know how to set a connection string for a passthrough query in
code? I can easily run my passthrough using a dsn but I can't find out
how to build it without a dsn. It is not an option for me to use a dsn
and I don't want to hardcode the connection string because I want to
easily switch databases (test to production, etc).
 
I am using a dsnless connection with NT Authentication. I've included
the connection code below.
 
 
Thank you!!!!
 
 
 
If gOcon.State = adStateOpen Then
    Exit Sub
End If
 
If IsEmpty(gvarSQLDataLocation) Then
    gvarSQLDataLocation = GetLocationINI("PathTestHome")
End If
 
'open the sql connection
With gOcon
    
    .ConnectionTimeout = 5000
    .CommandTimeout = 5000
    .CursorLocation = adUseServer
    '.Provider = "Microsoft.Jet.OLEDB.3.51"
    .Provider = "SQLOLEDB"
    
    'NT Authentication
    '.ConnectionString = "Provider=SQLOLEDB " & _
                        "Data Source=" & gvarSQLDataLocation & " " & _
                        "Initial Catalog=" & gstrDBName & " " & _
                        "Integrated Security=SSPIPersist Security
Info=False"
    'with
    .ConnectionString = "Data Source=" & gvarSQLDataLocation & ";" & _
                        "Integrated Security=SSPI;Persist Security
Info=False"
    'CMK End
    'Works with SQL Auth
   '.ConnectionString = "Provider=SQLOLEDB " & _
                        "Data Source=" & gvarSQLDataLocation & " " & _
                        "Initial Catalog=" & gstrDBName & " " & _
                        "User ID=Paruser " & _
                        "Password=Paruser"
    
    .Open
 
    .DefaultDatabase = gstrDBName
End With
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.574 / Virus Database: 364 - Release Date: 1/29/2004
 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list