Page 1 of 1

¿ ADO String Connection SQL Server ?

Posted: Wed Aug 14, 2013 10:52 pm
by albeiroval
Good day to all,

I'm using ADO to work with SQL Server 2008.

I'm trying to connect to SQL Server 2008 from a computer to the SQL Server 2008 server without success.

I work in local mode the following Connection string (it connect):

Provider = SQLNCLI10, Server = myServerAddress; Database = MyDatabase; Trusted_Connection = yes;

But in remote mode does not work (testing from another computer)

The connection to the SQL server as I have the windows authentication (default).

What string should I use for remote connection?

What should I configure SQL Server 2008 to Remote Connection I?

Sorry my english,

From already thank you very much,

Best regards.

Albeiro,

Re: ¿ ADO String Connection SQL Server ?

Posted: Thu Aug 15, 2013 8:54 am
by Enrico Maria Giordano
Albeiro,

I'm using the connection string below but I'm not sure it will work with your MSSQL version. Just try it:

Code: Select all | Expand

Provider=SQLOLEDB;Data Source=<ipaddress>;Initial Catalog=<databasename>;User Id=<userid>;Password=<password>


EMG

Re: ¿ ADO String Connection SQL Server ?

Posted: Thu Aug 15, 2013 1:21 pm
by Rick Lipkin
Albeiro

As Enrico mentions .. SqlOleDb still works even with Sql Server 2012 and SqlOleDb is native to all Windows OS... No real need at this point in time to install and use the SQLNCLI10 provider unless there is some function SqlOleDb does not provide.

I will mention, if you are having trouble connecting with 'remote' you will need to check your Sql Server settings to make sure 'remote' connections are turned on.

Rick Lipkin

Re: ¿ ADO String Connection SQL Server ?

Posted: Thu Aug 15, 2013 5:04 pm
by albeiroval
Enrico, Rick,

It seems to work well with:

Driver={SQL Server Native Client 10.0};Server=myServerAddress;Database=myDataBase;Trusted_Connection=yes;

This SQL Express 20008,

Thanks,

Albeiro.

Re: ¿ ADO String Connection SQL Server ?

Posted: Thu Aug 15, 2013 7:58 pm
by Rick Lipkin
Albeiro

Just remember .. if you distribute your application .. you will need to provide a setup routine to make sure each computer that runs your program has the SQLNCLI10 ole provider installed.

Rick Lipkin

Re: ¿ ADO String Connection SQL Server ?

Posted: Thu Aug 15, 2013 11:47 pm
by nageswaragunupudi
As Mr Rick said, SQLOLEDB is installed by default on all windows PCs and works well with all recent versions of SqlServer (including 2012).

If we want to connect through the native client SQLNCLI10, then we need to install this ourselves on all client PCs. For most work this is not necessary and SQLOLEDB is enough, unless we need to take advantage of all the latest features and new datatypes of the later versions.

Using Driver={SQL Server Native Client 10.0} connects through ODBC and does not allow us to take full potential of ADO. Always use Provider= .....

Re: ¿ ADO String Connection SQL Server ?

Posted: Mon Aug 26, 2013 4:06 am
by byron.hopp
You all my know this but:

Create a file on the hard drive with an extension of .udl

From the command prompt:
Type "copy con MyConStr.udl"
Press F6 to create the empty file
Type "Start MyConnStr.udl"
The UDL data wizard appears.
Answer the questions and press the test button to make sure it works, the connection string will be placed in the file.
Open the file with Notepad and pirate it into your code.

Hope this helps...

Byron ...