Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[DELPHI][MYSQL][ADO] Login System need help

Junior Spellweaver
Joined
Feb 5, 2006
Messages
129
Reaction score
87
im trying to create a login system using delphi 7, i want a username and password system that checks an Access database ive got the database setup and done alot of the coding but it doesnt work.

The Table is 'Login' and the fields are 'Username' and 'password'.
can anyone show me an example code for this type of system?

my coding.
Code:
Procedure TfrmLogin.BtnLoginClick(Sender: TObject);
   begin
try 
ADOQuery1.Close;
ADOQuery1.SQL.CLEAR;
ADOQuery1.SQL.ADD('SELECT Username, Password FROM Login');
ADOQuery1.SQL.ADD('WHERE Username = (:Username)');
ADOQuery1.SQL.ADD('AND Password = (:password)');
ADOQuery1.Parameters[0].Value := Edit1.Text;
ADOQuery1.Parameters[1].Value := Edit2.text;
ADOQuery1.Open;
can anybody help me here or show an example of a working code?


:?:
thanks, Jiro
 
Initiate Mage
Joined
Oct 31, 2010
Messages
8
Reaction score
9
(not tested..)
If the user can login, the app will work. If not, it will terminate.

PHP:
procedure Tform1.MyTest;
var
  conn: TMyConnection;
  qr: TMyQuery;
begin
  conn := TMyConnection.Create(Application);
  conn.Host := 'host IP';
  conn.User := 'db_user';
  conn.Password := 'pass';
  conn.Database:= 'db';
  conn.Connect; // AV here! :(

  qr := TMyQuery.Create(Application);
  qr.Connection := conn;           { Set Connection for the query }
  qr.SQL := 'SELECT * FROM members'; { Define SQL Query }
  qr.Open;                         { Execute SELECT Query }
  qr.First;                        { Move to first record }
  while not qr.Eof do begin        { loop until end of record }
    Memo1.Lines.Add(qr['first_name']); { print out OrderID field of current record }
    qr.Next;                       { Move to next record }
  end;                             { end loop }

  Memo1.Lines.Add(Format('Number of record: %d', [qr.RecordCount]));

  qr.ExecSQL;                      { Execute non-SELECT query }
  Memo1.Lines.Add(IntToStr(qr.RecordCount)); { Print out number of affected rows }

  conn.Disconnect;                 { Close connection }
end;

- iKnowRight
 
Last edited:
Back
Top