要连接远程InterBase数据库是不是必须要创建BDE别名?
我没有创建BDE别名,如果使用IBDatabase连接远程InterBase数据库,双击IBDatabase时打开了Database Component Editor窗口,设置好远程服务器后点击“Test”按钮,退出一个提示窗口,提示是:Error,Unable to complete network request to host "pmisdb.gdb",Failed to locate host machine.The specified name was not found in the hosts file or Domain Name Services.应该如何解决这个问题?
我没有创建BDE别名,如果使用IBDatabase连接远程InterBase数据库,双击IBDatabase时打开了Database Component Editor窗口,设置好远程服务器后点击“Test”按钮,退出一个提示窗口,提示是:Error,Unable to complete network request to host "pmisdb.gdb",Failed to locate host machine.The specified name was not found in the hosts file or Domain Name Services.应该如何解决这个问题?
[system]
serverpath=192.168.0.1:d:\data.gdb然后在formshow事件中
void __fastcall TForm1::FormShow(TObject *Sender)
{
try
{
char uu[100];
AnsiString tmp;
AnsiString tmp1;
tmp = ExtractFilePath(Application->ExeName) + "system.ini";
GetPrivateProfileString("system","serverpath","d:\data.gdb",uu,50,tmp.c_str());
tmp1 = uu;
IBDatabase1->DatabaseName = tmp1;
IBDatabase1->Connected = true;
IBTable1->Active = true;
IBTable2->Active = true;
UserTable->Active = true ;
ADOConnection1->Connected = true;
ADOTable1->Active = true;
Label3->Caption = Date();
}
catch(...)
{
MessageBox(NULL,"不能连接到服务器,请进行服务器设置后再使用。","对不起",MB_ICONINFORMATION);
Close();
}}接分了。
serverpath=192.168.0.1:d:\data.gdb
当然这里的IP是你服务器的IP
地址是你数据库文件 的地址。