MSSQL Connection String Example?

Posted on 2009-02-15
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

    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
    every type possible @

    a must for anyone using sql

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    Suggested Solutions

    SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
    In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
    This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
    Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now