|
안녕하세요...
냥꾼입니다...
빌더를 한지 한 13일이 되어 가는 군요...
그런데 하면 할 수록 정말 산넘어 산입니다...
밑의 소스에서 +님 환영합니다.에서용...
DB에서 Query값을 검색해서 가지고 오는 것은 성공했습니다.
즉, DB의 ID필드에 test가 있다면요...
test님 환영합니다. 이렇게 나옵니다.
그런데 문제는 뭐냐면요...
DB의 ID필드에 등록이 안된 아이디를 치고 들어가면
그냥 님 환영합니다. 이런 식으로 나오는데요.
이걸 없는 아이디입니다. 이런식으로 검색을 돌려주려구 합니다.
그런데 잘 안되는 군요...아시는 분 있으시면 알려주시면 감사르..
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String Where="where";
String And="and";
String id="id='" + Edit1->Text+"'";
Query1->Close();
Query1->SQL->Clear();
Query1->SQL->Add("select * from dbo.member");
if((Edit1->Text !="") && (Edit2->Text !=""))
{
Query1->SQL->Add(Where);
Query1->SQL->Add(id);
Query1->Open();
StaticText3->Caption = Query1->FieldByName("id")->AsString + "님 환영합니다.";
}
else
{
if ((Edit1->Text != "") && (Edit2->Text == "" ))
{
StaticText3->Caption = "Password를 입력하세요";
StatusBar1->Panels->Items[0]->Text = "Password를 입력하세요.";
}
else if ((Edit1->Text =="") && (Edit2->Text !=""))
{
StaticText3->Caption = "ID를 입력하세요";
StatusBar1->Panels->Items[0]->Text = "ID를 입력하세요.";
}
else if ((Edit1->Text =="") && (Edit2->Text ==""))
{
StaticText3->Caption = "ID와 Password를 입력하세요";
StatusBar1->Panels->Items[0]->Text = "ID와 Password를 입력하세요.";
}
}
}
|