私はMicrosoft Visual C++ 2008 Express Editionを使用しています。MVC++とSQLAPI ++の接続
私はSQL API Webサイト[http://www.sqlapi.com/index.html]に従っています。
私はSqlApi ++をインストールしましたが、私のコンパイラは私が間違って何をやっている#include <SQLAPI.h>
を検出していませんか?
これは私のコードです:
#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(
"test", // database name
"tester", // user name
"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", (const char*)x.ErrText());
}
return 0;
}
@Seril私はそれをやっています。そして私のポイントはthat.nowです。データベースとテーブルpresent.iを確認するために私のsqlApIを開く必要があります。私はちょうど私たちがsqlserver 2005のようにしたいと思っています。私はsqlApiがこのオプションを提供する必要があることを願っています – user1118700
@seril私はchanges.Nowコンパイラがヘッダーファイルを検出することができます。今はこのcon.Connect( "テスト "、//データベース名 "テスター "、//ユーザー名 "テスター "、//パスワード SA_Oracle_Client); に問題があります。私はsqlapiを開いて新しいデータベースを作成しなければならないと思います。 – user1118700