On Wed, Dec 17, 2008 at 6:49 PM, Rafael Copquin <[email protected]> wrote: > After a number of unsuccessful tries, I could finally install SQLServer > Express 2008 in my VISTA Home Premium notebook. > > I created a database called test and one simple table called customers with > one pk field and two regular fields, firstname and lastname. > > I also created an ODBC connection called myconnection.dsn with the following > script (just used notepad to read the file) > > *!* [ODBC] > *!* DRIVER=SQL Server > *!* UID=marcelo > *!* WSID=RAFAEL > *!* APP=Microsoft(R) Windows(R) Operating System > *!* Trusted_Connection=Yes > *!* SERVER=RAFAEL\SQLEXPRESS > > I tested the connection and got the successful connection message. BTW, I > use windows authentication, no password at all. > > I want to run this program from VFP9 > > cConnString ='dsn=c:\users\marcelo\documents\myconnection;uid=marcelo' > > cSQLCmd = "select * from customers" > > nHandle = SQLSTRINGCONNECT (cConnString) > > > > SQLEXEC (nHandle, cSQLCMD, 'curCustomers' ) > > > SQLDISCONNECT (nHandle) > > select curCustomers > browse > > > My problem is that I can't get the connection string right and of course, I > get an error (the program checks for the handle number and if it is > negative, returns an error message. Omitted here for clarity) > > Could you guys please tell me how to write the connection string? -------------------------------
Some people like DSN, I like a good Text string myself. http://www.connectionstrings.com/sql-server-2005 This will determine how you could or would use any of the 15-20 different versions of connection to a SQL Server db. 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; Equivalent key-value pair: "Integrated Security=SSPI" equals "Trusted_Connection=yes" Hope this helps. -- Stephen Russell Sr. Production Systems Programmer Mimeo.com Memphis TN 901.246-0159 _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

