У меня возникли трудности с включением SQLAPI в мой проект VS 2019.
Я добавил каталог .lib в мои дополнительные каталоги библиотек в компоновщике в свойстве и добавил файл заголовка SQLAPI в каталог исполняемого файла.
При запуске их кода подключения ex я получаю код ошибки: фатальная ошибка LNK1120: 9 неразрешенных внешних.
Может кто-нибудь мне помочь? :-)
#include <stdio.h> // for printf
#include <SQLAPI.h> // main SQLAPI++ header
int main(int argc, char* argv[])
{
SAConnection con; // create connection object
try
{
// connect to database
// in this example it is Oracle,
// but can also be Sybase, Informix, DB2
// SQLServer, InterBase, SQLBase and ODBC
con.Connect(
_TSA("test"), // database name
_TSA("tester"), // user name
_TSA("tester"), // password
SA_Oracle_Client);
printf("We are connected!\n");
// Disconnect is optional
// autodisconnect will ocur in destructor if needed
con.Disconnect();
printf("We are disconnected!\n");
}
catch(SAException &x)
{
// SAConnection::Rollback()
// can also throw an exception
// (if a network error for example),
// we will be ready
try
{
// on error rollback changes
con.Rollback();
}
catch(SAException &)
{
}
// print error message
printf("%s\n", x.ErrText().GetMultiByteChars());
}
return 0;
}