Author: Stephen Russell
Posted: 2009-01-15 at 09:39:05
On Thu, Jan 15, 2009 at 6:53 AM, Rafael Copquin <rcopquin@ciudad.com.ar> wrote:
> As said in a previous post, I am beginning to experiment with SQLServer,
> using SQLServer 2005 Std Ed. on an XP Prof SP2 machine.
>
> I managed to build my first edit form, using an ODBC connection.
>
> I created an ODBC connection called MYCONNECTION, which uses the database
> called TEST, and a table called CUSTOMERS.
>
> if I use:
>
> cConnString = 'MYCONNECTION'
>
> and
>
> nHandle = SQLConnect(cConnString)
>
> the connection is succesful
>
> If instead I use:
>
> cConnString='Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security
> Info=False;Initial Catalog=test;Data Source=RAFAELPC\SQLEXPRESS'
>
> I have to use:
>
> nHandle = SQLStringConnect(cConnString)
>
> This opens a dialog forcing me to choose the MYCONNECTION ODBC source, and
> then the connection succeeds.
>
> Questions:
>
> 1) why does the above dialog appear and how can I get rid of it?
> 2) why does sqlconnect not work with the second connection string (the long
> one)?
>
> Can anyone give me the answers?
------------------------
You said 2005? Your Driver statement doesn't look right. Try either
versions of text for your conn string:
SQL Native Client 9.0 ODBC Driver
Type: ODBC Driver
Usage: Driver={SQL Native Client}
Manufacturer: Microsoft
Standard security
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;
Uid=myUsername;Pwd=myPassword;
Are you using SQL Server 2005 Express? Don't miss the server name
syntax Servername\SQLEXPRESS where you substitute Servername with the
name of the computer where the SQL Server 2005 Express installation
resides.
Trusted Connection
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;
Trusted_Connection=yes;
HTH
from <http://www.connectionstrings.com/sql-server-2005#109>
--
Stephen Russell
Sr. Production Systems Programmer
First Horizon Bank
Memphis TN
901.246-0159