Arsip: Handle error "login database di MySQL"

 
user image
more 12 years ago

zuq

mohon bantuanya tmen2.... saya pake TSQLConnection di dbExpress untk akses database yg ada d MySQL tp lewat coding...... with SQLConnection1 do begin Connected:= False; ConnectionName := 'MySQLConnection'; DriverName := 'MySQL'; GetDriverFunc := 'getSQLDriverMYSQL'; LibraryName := 'dbexpmysql.dll'; LoadParamsOnConnect := false; LoginPrompt := false; params.Values['DriverName'] := 'MySQL'; params.Values['HostName'] := Edit1.Text; params.Values['Database'] := 'admin'; params.Values['User_Name'] := Edit2.Text; params.Values['Password='] := Edit3.Text; params.Values['BlobSize'] := '-1'; params.Values['LocaleCode'] := '0000'; VendorLib := 'libmysql.dll'; Connected := true; end; jika host, database, user dan pswd yg d isikan benr maka sukses tp klo sebaliknya maka muncul : ------------------------------------------------------------------------------ project project1.exe raised exception class EDatabaseError with message 'dbExpress Error:Invalid username/Password'............ ------------------------------------------------------------------------------ saya mohon bantuny Cara menghandle pesan tersebut, misal d ganti dng "Koneksi Gagal ato yg lebih keren......"
user image
more 12 years ago

donlego


with SQLConnection1 do
begin
try
  Connected:= False;
  ConnectionName := 'MySQLConnection';
  DriverName := 'MySQL';
  GetDriverFunc := 'getSQLDriverMYSQL';
  LibraryName := 'dbexpmysql.dll';
  LoadParamsOnConnect := false; 
  LoginPrompt := false;
  params.Values['DriverName'] := 'MySQL';
  params.Values['HostName'] := Edit1.Text;
  params.Values['Database'] := 'admin';
  params.Values['User_Name'] := Edit2.Text;
  params.Values['Password='] := Edit3.Text;
  params.Values['BlobSize'] := '-1';
  params.Values['LocaleCode'] := '0000';
  VendorLib := 'libmysql.dll';
 Connected := true;
except
 showmessage('koneksi gagal')
end;
end;
user image
more 12 years ago

zuq

-> mkasih ms Dayat, masih tetep pesan yg muncul sma :cry:
user image
more 12 years ago

donlego

coba jalaninnya di luar ide delphi bos
user image
more 12 years ago

zuq

:D ya....ya....bisa, kok bisa gitu :roll: mkasih ms ...... sukses ya.....
user image
more 12 years ago

deLogic

@zuq: karena Debugger pada IDE Delphi mengambil alih semua eksepsi kesalahan yang terjadi.
user image
more 12 years ago

yayaretina

@zug benul yg disampaikan rekan @deLogic. jika tidak menginginkan Debugger Exception Notification aktif, Pilih Options>Debugger Options>Language Exceptions dan uncheck pada Stop on Delphi Exceptions.
user image
more 12 years ago

zuq

ok, nih uda aq tmbahi kanan kiri atas dan bawah :D mumpung bisa, ternyata msalahnya d situ ya...., makasih ms dayat, ms delogic & ms yayaretina... sukses smuaaa...
more ...
  • Pages:
  • 1
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com