while(1) { MSSQLSession mssql; for(;;) { String cs = "Driver={SQL Server};"; cs << "Server=" << "127.0.0.1" << ';'; String h = "sa"; if(IsNull(h)) cs << "Trusted_Connection=Yes;"; else { cs << "UID=" << h << ';'; // Cout() << "Password:"; cs << "PWD=" << pass << ';'; // Cout() << "Database (empty for default):"; h = ""; if(IsNull(h)) cs << "Database=" << h << ';'; } Cout() << "Connect mssql:" << cs << "\n"; if(!mssql.Connect(cs)) Cout() << "Connect failed: " << mssql.GetLastError() << '\n'; else break; } #ifdef _DEBUG mssql.SetTrace(); #endif //do some work Sleep(1000); mssql.Close(); }
Report message to a moderator