CDatabase & CRecordset
-
Hello every body I am using a CRecordset object but I want to make my own connection string, not defult,so how can i make this? is it don by using CDatabase Object and how? Best Regards :)
If you are using access you can just give file path or if you use ODBC driver this is another example:
CDatabase aDB;
try
{
aDB.OpenEx("DSN=MyDSN");
// Specify login information if using SQL Server authentication,
// e.g., aDB.OpenEx("ODBC;DSN=MyDSN;UID=sa;PWD=");CRecordset aRS(&aDB);
aRS.Open(CRecordset::forwardOnly,
"SELECT DISTINCT state FROM authors");
.
.
.
.or another example for SQLServer(without ODBC) this is a connection string:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=NorthWind;Data Source=MAZY;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MAZY;Use Encryption for Data=False;Tag with column collation when possible=False
Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
Wish You Were Here-Pink Floyd-1975