Form1
//---------------------------------------------------------------------------
#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)
{
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from Manager ");
ADOQuery1->SQL->Add("where Mname='"+Edit1->Text+"' and PW='"+Edit2->Text+"'");
if(ADOQuery1->ExecSQL())
{
ShowMessage("登陆成功");
Form2->Show();
}
else
{
ShowMessage("用户名或密码错误!");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#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)
{
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add("select * from Manager ");
ADOQuery1->SQL->Add("where Mname='"+Edit1->Text+"' and PW='"+Edit2->Text+"'");
if(ADOQuery1->ExecSQL())
{
ShowMessage("登陆成功");
Form2->Show();
}
else
{
ShowMessage("用户名或密码错误!");
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------