+1  A: 

Try setting the provider in the connection string

conn.ConnectionString = "Provider=SQLOLEDB.1;Data Source=XXX;Initial Catalog=XXX;User ID=<XXX>;Password=<XXX>;"

Note: I haven't tested it but it should work

Kane
To use the SQL 2005 client, use a provider of SQLNCLI
Ed Harper
SQLOLEDB and SQLNCLI both work with SQL 2005. I've not seen a performance difference with either.
AnonJr
Ok, from my code, i remove provider, and mode replace with this code : conn.ConnectionString = "Provider=SQLOLEDB.1;Data Source=F:\admin.mdf;Initial Catalog=admin;" I also remove uid and pass coz i'm not using it. This type of error appeared: Error: Invalid authorization specificationSource: Microsoft OLE DB Provider for SQL ServerSystem: These workstations have sessions with open files on this server:
+1  A: 

For all your connection string needs: http://www.connectionstrings.com/

Mr. Smith
A: 

With SQL Server you don't connect directly to the file. Access, being a file-based RDBMS is a little different.

Following your example, it would look something like this:

Dim conn, sql
sql = "SELECT * FROM tblOutbox"
Set conn = CreateObject("ADODB.Connection")
With conn
      .Mode = adModeReadWrite
      .ConnectionString = "Provider=SQLOLEDB;server=[servername];database=[databasename]uid=[insertuser];pwd=[insertpassword];"
      .Open 
End With
If conn.State = adStateOpen Then
      WScript.Echo "Connection was established."
End If
conn.Close
Set conn = Nothing

There's usually a more compact way of doing this, but without the context its hard to give a better example

AnonJr
What is servername? where can i find it? Answer from Kane stated have Data Source, Initial catalog and etc. What are differences with yours? This one using c# : Connection String ("Data Source=.\SQLEXPRESS;AttachDbFilename=F:\Test2.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"). Any useful things that i can take from here?
The server name is the instance of SQL Server you are trying to connect to. The database name is the name of the database - not the .mdf file.
AnonJr
If you don't know what they are, ask the admin.
AnonJr
A: