Posts: 1,769
Threads: 410
Joined: Feb 2003
I was looking through your database help for info to create an ODBC connection to a SQL server.
I hit one of the sites that has all those connection types but i'm not sure how to take that and put it into a QM format.
when you get a chance, can you whip up something that'll get me a connection to a sql server via an odbc (i might also need to pass id/password too).
thanks.
Posts: 12,061
Threads: 140
Joined: Dec 2002
In
http://www.codeproject.com/database/con ... trings.asp the code is in C/C++ language. Adjacent strings are joined, even if in multiple lines. _T is for Unicode.
strConnect = _T("Provider=sqloledb;Data Source=MyServerName;"
"Initial Catalog=MyDatabaseName;"
"User Id=MyUsername;Password=MyPassword;");
in qm is
Macro
str strConnect = "Provider=sqloledb;Data Source=MyServerName;Initial Catalog=MyDatabaseName;User Id=MyUsername;Password=MyPassword;"
Database db.Open(strConnect)
In
http://www.carlprothman.net/Default.aspx?tabid=81 the code is in Visual Basic. Strings are joined using &, and lines are joined using _.
oConn.Open "ODBC;Driver={SQL Native Client};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword"
in qm is
Macro
Database oConn.Open("ODBC;Driver={SQL Native Client};Server=MyServerName;Database=myDatabaseName;Uid=myUsername;Pwd=myPassword")
-----
I cannot test how it works.
Posts: 1,769
Threads: 410
Joined: Feb 2003
here's what i used to hit an ODBC to SQL Server db if you have the ODBC setup in your "Data Sources (ODBC)" under the "System DSN"
Database oConn.Open("DSN=name of the odbc connection here")