Answer the question
In order to leave comments, you need to log in
How can I check the connection to the MS SQL database in C++ code?
DB: Microsoft SQL of any version.
Preferably the easiest way (in terms of, without connecting third-party libraries).
You just need to check the connectivity.
You can't use the .Net Framework in the job, and MFC is highly discouraged.
Project in Visual Studio 2008 Professional
Found one way:
CDatabase * db = new CDatabase ();
if (!db->OpenEx (args [2], CDatabase::noOdbcDialog))
{
printf ("Не удалось соединиться с БД\n");
ExitProcess (1);
}
db->Close();
Answer the question
In order to leave comments, you need to log in
As the name clearly implies, WinAPI is an API to Windows functions and nothing more. Operation from a DB is operation from a DB and does not concern Windows in any way. If you don't want to use MFC, then look at Qt, if you don't want to, then choose from the list: rsdn.ru/poll/1822 or search in Google
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question