📄 unit1.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if((Edit1->Text.Length() ==0)||(Edit2->Text.Length() ==0))
{
Application->MessageBox("不能为空",
"提示",MB_ICONINFORMATION | MB_OK);
return;
}
// creating the alias could take a while, change the cursor
// to an hourglass.
Screen->Cursor = crHourGlass;
hDBISes Session; // declare a bde session handle
DbiInit(NULL); // initialize BDE.
DbiStartSession(NULL,Session,""); // start a temporaray bde session
AnsiString serverip =Edit1->Text;
AnsiString dbaddr =Edit2->Text;
serverip ="SERVER NAME:"+serverip+":"+ dbaddr+";";
AnsiString NextStr=serverip+"USER NAME:SYSDBA;SQLQRYMODE:SERVER;SQLPASSTHRU MODE:SHARED AUTOCOMMIT";
DBIResult isOK;
/* isOK=fDbiAddAlias1("net_zyj",
"PATH:frobosrv:d:/interbas;"
"SERVER NAME:frobosrv:d:\interbas\slim.gdb;"
"USER NAME:SYSDBA;"
"SQLQRYMODE:SERVER;"
"SQLPASSTHRU MODE:SHARED AUTOCOMMIT");
*/
isOK=DbiAddAlias(NULL, "QWGC_CLIENT", "INTRBASE", NextStr.c_str(), TRUE);
switch (isOK)
{
case DBIERR_NONE:
Application->MessageBox("成功","提示",MB_ICONINFORMATION | MB_OK);
break;
case DBIERR_NAMENOTUNIQUE:
Application->MessageBox("BDE名称已存在","提示",MB_ICONINFORMATION | MB_OK);
break;
case DBIERR_UNKNOWNDRIVER:
Application->MessageBox("BDE驱动无效","提示",MB_ICONINFORMATION | MB_OK);
break;
case DBIERR_OBJNOTFOUND:
Application->MessageBox("没有找到BDE相关文件","提示",MB_ICONINFORMATION | MB_OK);
break;
}
DbiCloseSession(Session); // close the session
DbiExit(); // shut down the BDE.
Screen->Cursor = crDefault;
Application->Terminate();
/* if(isOK==DBIERR_NONE)
{
DbiCloseSession(Session); // close the session
DbiExit(); // shut down the BDE.
Screen->Cursor = crDefault;
Application->Terminate();
} // reset cursor.
else
{
DbiCloseSession(Session); // close the session
DbiExit(); // shut down the BDE.
Screen->Cursor = crDefault;
}
*/
}
//---------------------------------------------------------------------------
/* DBIResult TForm1::fDbiAddAlias1(char * AliasName, char * AliasPath)
{
DBIResult rslt;
rslt = DbiAddAlias(NULL, AliasName, "INTRBASE", AliasPath, TRUE);
return rslt;
}
*/
void __fastcall TForm1::Button2KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == VK_F12)
{
if(Shift.Contains(ssShift))
{
OKBottomDlg =new TOKBottomDlg(this);
OKBottomDlg->ShowModal();
//OKBottomDlg->delete;
}
}
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -