Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Prevod na kod od Delphi u C++ B

[es] :: C/C++ programiranje :: Prevod na kod od Delphi u C++ B

[ Pregleda: 1735 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

milan_sr
Milan Savov
Strumica

Član broj: 262218
Poruke: 108
89.185.211.*



+26 Profil

icon Prevod na kod od Delphi u C++ B15.06.2010. u 12:30 - pre 168 meseci
Jer moze neko da mi "prevede" ovaj kod u c++

procedure TForm2.Button1Click(Sender: TObject);
begin
{ if Form1.ADOTable2.Locate('Username;Password', VarArrayOf([edit1.Text , edit2.Text]),[])
then begin
edit1.Text:='';
edit2.Text:='';
Edit1.SetFocus;
form1.Showmodal
end
else begin
Showmessage('Please enter correct username and password');
edit1.SetFocus;

end;}


if form1.ADOTable2.locate('Username',edit1.Text,[]) then

if form1.ADOTable2.FieldByName('Password').AsString =edit2.Text then
begin
edit1.Text:='';
edit2.Text:='';
Edit1.SetFocus;
form1.Showmodal
end
else
begin
showmessage('Wrong password');
edit2.SetFocus;
end else begin
showmessage('Username not found');
edit1.SetFocus;
end;
end;
 
Odgovor na temu

X Files
Vladimir Stefanovic
Pozarevac

SuperModerator
Član broj: 15100
Poruke: 4902
212.200.65.*

Jabber: xfiles@elitesecurity.org


+638 Profil

icon Re: Prevod na kod od Delphi u C++ B15.06.2010. u 12:50 - pre 168 meseci
Netestirano !!!
Code:

void __fastcall TForm2::Button1Click(TObject *Sender)
{
    TLocateOptions Opts;
    Opts.Clear();

    Variant locvalues[2];
    locvalues[0] = Variant(Edit1->Text);
    locvalues[1] = Variant(Edit2->Text);

    if ( Form1->ADOTable2->Locate( "Username;Password", VarArrayOf( locvalues, 1 ), Opts )
    {
        Edit1->Text = "";
        Edit2->Text = "";
        Edit1->SetFocus();
        Form1->ShowModal();
    }
    else
    {
        ShowMessage( "Please enter correct username and password" );
        Edit1->SetFocus();
    }



    if ( Form1->ADOTable2->Locate( "Username", Edit1->Text, Opts )
    {
        if ( Form1->ADOTable2->FieldByName( "Password" )->AsString == Edit2->Text )
        {
            Edit1->Text = "";
            Edit2->Text = "";
            Edit1->SetFocus();
            Form1->ShowModal();
        }
        else
        {
            ShowMessage( "Wrong password" );
            Edit2->SetFocus();
        }
    }
    else
    {
        ShowMessage( "Username not found" );
        Edit1->SetFocus();
    }
}


Provericu jos oko ovog dela:
Variant locvalues[2];
locvalues[0] = Variant(Edit1->Text);
locvalues[1] = Variant(Edit2->Text);
... jer se kao kroz maglu secam da tu postoje neki problemi, ali svakako pokusaj.
 
Odgovor na temu

milan_sr
Milan Savov
Strumica

Član broj: 262218
Poruke: 108
89.185.211.*



+26 Profil

icon Re: Prevod na kod od Delphi u C++ B15.06.2010. u 13:48 - pre 168 meseci
Hvala mnogo,

A kako da uradim backup od baze da se pravi nekud na hdd ili pa na meil...jer to moguce...?
 
Odgovor na temu

[es] :: C/C++ programiranje :: Prevod na kod od Delphi u C++ B

[ Pregleda: 1735 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.