MSSQL Connection String Example?

Posted on 2009-02-15
Medium Priority
Last Modified: 2012-05-06
I'm trying to connect to a MSSQL database on another server (host) so I have to use a connection string. Below is what I'm trying to use. Is this format correct?

ConnectionString = "DRIVER=SQL Server;SERVER=ipaddress;UID=userid;PWD=password;

Of course, the ipaddress, userid, password and database are replaced with my actual information.

I get the following error:

ADODB.Command error '800a0bb9'
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

Thanks, Gary
Question by:WebStudioWest
LVL 57

Accepted Solution

Raja Jegan R earned 1000 total points
ID: 23645944
Try using any of the one below based on your requirements

Standard security
Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase;Uid=myUsername; Pwd=myPassword;

Are you using SQL Server 2008 Express? Don't miss the server name syntax Servername\SQLEXPRESS where you substitute Servername with the name of the computer where the SQL Server 2008 Express installation resides.
 Trusted connection

Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase; Trusted_Connection=yes;Equivalent key-value pair: "Integrated Security=SSPI" equals "Trusted_Connection=yes"
Connecting to an SQL Server instance
The syntax of specifying the server instance in the value of the server key is the same for all connection strings for SQL Server.

Provider=SQLNCLI10;Server=myServerName\theInstanceName;Database=myDataBase; Trusted_Connection=yes;
LVL 31

Assisted Solution

by:James Murrell
James Murrell earned 1000 total points
ID: 23645967
every type possible @http://www.connectionstrings.com/

a must for anyone using sql

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Microsoft provides a rich set of technologies for High Availability and Disaster Recovery solutions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question