966
asked on
LOGIN TO SQL DATABASE
How can i do this:
have a edit.text for users username
have a edit2.text for users password
then connects to SQL database on "66.22.33.44"
database name: mydatabase_db
logs in with name and password.
If OK then form2.show;
if not, label1.caption:="not logged in";
================
please im desperate now...
if i need components please proive link and code how to do it please.
This is all.
have a edit.text for users username
have a edit2.text for users password
then connects to SQL database on "66.22.33.44"
database name: mydatabase_db
logs in with name and password.
If OK then form2.show;
if not, label1.caption:="not logged in";
================
please im desperate now...
if i need components please proive link and code how to do it please.
This is all.
ASKER
yeah, i know that already. Thanks for commenting anyway.
You didn't provide us some information
What is type of your database?
Have experience about SQL database in Delphi?
As quick response check this topic
https://www.experts-exchange.com/questions/25186663/ODBC-in-delphi.html
What is type of your database?
Have experience about SQL database in Delphi?
As quick response check this topic
https://www.experts-exchange.com/questions/25186663/ODBC-in-delphi.html
Hi 966.
Its pretty simple.
There are may DAC components out there.
(Direct Access components)
The one that i trully love is AnyDAC. You can contact your server NO MATTER what kind
of database you are running up there.
(Or you can try ADO, in your Delphi)
You can download it from here:
http://www.remobjects.com/trials.aspx#ad2
If you don't like it then you can google for DAC components for Delphi.
All the components you will try will work with the way i'll describe.
On your form after you install you DAC component drop :
1) A connection (in case of AnyDAC its named: ADConnection)
2) A Query (in case of AnyDAC its named: ADQuery)
3) A WaitCursor (this is needed for AnyDAC only its named: ADGUIxWaitCursor)
4) Depends on your database on your server if its MySQL then drop a ADPhysMySQLDriverLink ...
Else Oracle: ADPhysOracleDriverLink1 etc...
Its all very simple after that.
With Button1 click event do :
AdConnection1.Params.Value s['Passwor d']:= Edit1.Text;
AdConnection1.Params.Value s['Usernam e']:= ...Edit2.Text;
AdConnection1.Params.Value s['Databas e']:= The name of your database here.
Hope this helps.
If you have any question don't hesitate.
Its pretty simple.
There are may DAC components out there.
(Direct Access components)
The one that i trully love is AnyDAC. You can contact your server NO MATTER what kind
of database you are running up there.
(Or you can try ADO, in your Delphi)
You can download it from here:
http://www.remobjects.com/trials.aspx#ad2
If you don't like it then you can google for DAC components for Delphi.
All the components you will try will work with the way i'll describe.
On your form after you install you DAC component drop :
1) A connection (in case of AnyDAC its named: ADConnection)
2) A Query (in case of AnyDAC its named: ADQuery)
3) A WaitCursor (this is needed for AnyDAC only its named: ADGUIxWaitCursor)
4) Depends on your database on your server if its MySQL then drop a ADPhysMySQLDriverLink ...
Else Oracle: ADPhysOracleDriverLink1 etc...
Its all very simple after that.
With Button1 click event do :
AdConnection1.Params.Value
AdConnection1.Params.Value
AdConnection1.Params.Value
Hope this helps.
If you have any question don't hesitate.
ASKER
Thanyou very much CodedK:, ill chec it out now.
ASKER
ive some DAC components, but they dont have much with them. Can you lin me to some delphi 7 AnyMAC components, ?
also do they cost, n how much?
also do they cost, n how much?
ASKER
Not MAC sorry lol, DAC.
I have MyDac but i need AnyDAC
I have MyDac but i need AnyDAC
So, what part of the problem are you having trouble with?
- Connecting to the database at all?
- Specifying the UNC for the IP address?
- Figuring out which components to use?
- What?
ASKER
n/m i thin you posted above, sorry i didnt chec that link untill now
ASKER
Hi,mate. Got them, AnyDAC.
AdConnection1.Params.Value s['Passwor d']:= Edit1.Text;
AdConnection1.Params.Value s['Usernam e']:= ...Edit2.Text;
AdConnection1.Params.Value s['Databas e']:= The name of your database here.
can you show me where i put database name, im not sure how to set it out
AdConnection1.Params.Value
AdConnection1.Params.Value
AdConnection1.Params.Value
can you show me where i put database name, im not sure how to set it out
ASKER
AdConnection1.Params.Value s['Passwor d']:= Edit1.Text;
AdConnection1.Params.Value s['Usernam e']:= Edit2.Text;
AdConnection1.Params.Value s['Databas e']:= 'servicefg_dlik;
??
also, how would i know its ok..
can form2.show if its connected fine?
andif its wrong password and username label1.caption changes to error ?
AdConnection1.Params.Value
AdConnection1.Params.Value
??
also, how would i know its ok..
can form2.show if its connected fine?
andif its wrong password and username label1.caption changes to error ?
Hi 966 sorry for not answering earlier.
Its 3 in the morning here, but i've made an example application for you.
Well, do this :
procedure TForm4.Button1Click(Sender : TObject);
var
Flag: Boolean;
begin
Flag:=True;
ADConnection1.Params.Value s['User_Na me']:= Edit1.Text;
ADConnection1.Params.Value s['Passwor d']:= Edit2.Text;
Try
ADConnection1.Connected:=T rue;
Except
begin
ShowMessage('Unauthorized access');
Flag:=False;
end;
End;
if Flag then
begin
ShowMessage('ready to load form2 now...');
//...
end;
end;
NOW
1) Double click ADConnection1
Inside the window write the name of your database
Check the image i uploaded.
2) IF you use MySQL drop this dll inside your folder (i uploaded as bmp. rename it to dll).
3) IF YOU use MySQL then click ADPhysMySQLDriverLink1 and from the Properties the "Vendor Lib" add the path to the dll i uploaded.
Simple as that (check the images, they will help)
If you stuck in something tell me.
I uploaded some images too , just for visual aid.
Hope this will help.
libmySQL.bmp
Connection-Options.png
vendor-library.png
Its 3 in the morning here, but i've made an example application for you.
Well, do this :
procedure TForm4.Button1Click(Sender
var
Flag: Boolean;
begin
Flag:=True;
ADConnection1.Params.Value
ADConnection1.Params.Value
Try
ADConnection1.Connected:=T
Except
begin
ShowMessage('Unauthorized access');
Flag:=False;
end;
End;
if Flag then
begin
ShowMessage('ready to load form2 now...');
//...
end;
end;
NOW
1) Double click ADConnection1
Inside the window write the name of your database
Check the image i uploaded.
2) IF you use MySQL drop this dll inside your folder (i uploaded as bmp. rename it to dll).
3) IF YOU use MySQL then click ADPhysMySQLDriverLink1 and from the Properties the "Vendor Lib" add the path to the dll i uploaded.
Simple as that (check the images, they will help)
If you stuck in something tell me.
I uploaded some images too , just for visual aid.
Hope this will help.
libmySQL.bmp
Connection-Options.png
vendor-library.png
ASKER
THANKS for your amazing description, im just half way through.
2 things friend.
1) when i select SQL from list it gives an error of the DLL, but i am unable to get it from that link, it wont let me right click save AS, or even click it. Not AV related as its OFF.
2 things friend.
1) when i select SQL from list it gives an error of the DLL, but i am unable to get it from that link, it wont let me right click save AS, or even click it. Not AV related as its OFF.
ASKER
its ok mate, i got it from asite. doing project now will report back
ASKER
uADPhysManager.pas
not found when it tries to give an error. ill keep trying
not found when it tries to give an error. ill keep trying
ASKER
also, i put details in exact, and even with correctpass and name it still says its wrong?
any idears mate, thanyou so much by the way
any idears mate, thanyou so much by the way
ASKER
database_name
database_name << again
then inside of that we have:
ID username password
1 test 2cc5143f1dd3c0f9a00a146d37 bffff7e51a ff
2 lu5 343d9040a671cfffffd45832ee 5381860e29 96
3 Ais 2cc5143f13c0f9a00a1fffdd46 d37b7e51af f
so when say Ais logs in he can with his correct deatils.
database_name << again
then inside of that we have:
ID username password
1 test 2cc5143f1dd3c0f9a00a146d37
2 lu5 343d9040a671cfffffd45832ee
3 Ais 2cc5143f13c0f9a00a1fffdd46
so when say Ais logs in he can with his correct deatils.
ASKER
sorry for all the posts , but i think it must have something to do with that .PAS files, as it is not making the connection active? maybe.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will upload the application here for you so we don't have other errors.
You say you got the dll from another site. Then the error is strange. Maybe the dll file is to blame...
There is no error in version 2.015 of AnyDAC and it works for every version of Delphi.
I uploaded my application with sources.
http://www.megaupload.com/?d=LEZMHMSW
Try it and tell me :)
You say you got the dll from another site. Then the error is strange. Maybe the dll file is to blame...
There is no error in version 2.015 of AnyDAC and it works for every version of Delphi.
I uploaded my application with sources.
http://www.megaupload.com/?d=LEZMHMSW
Try it and tell me :)
>>966
in all these posts, you haven't said what database you are trying to connect to
is it mysql ?
is it ms sqlserver ?
is it oracle ?
is it teradata ?
this is the basic question you need to answer first !
in all these posts, you haven't said what database you are trying to connect to
is it mysql ?
is it ms sqlserver ?
is it oracle ?
is it teradata ?
this is the basic question you need to answer first !
ASKER
thanks again for the uploads and everything you have done. For me, even in your example, it still asks for the same file.
I reinstalled the trial last night, maybe that has something to do with it?
Ive followed each step close and everythingyou said is find, untill i come to compilem and it stops, gives me a browse path for the file. see attached image:
I even replaced the DLL file. haha, i have no idea mate. Im going to try it with delphi6 later today when i get in from work, then reinstall delphi7 incase something messed up or its conflicting with some of my million components haha.
Thankyou so much, your so helpful and thats what makes experts exhange a pleasure to get help from.
Oh by the way, i couldn't even get ur example to work, so itmust be a problem with the objects.
Ill try sys-restore tonight and then re-add the components..
Is there a patch because they seem expensive, and im only ever going to be logging in to mySql.
well, any user tat gets my client, if they are registerd to my site, they can login via the delphi app.
I reinstalled the trial last night, maybe that has something to do with it?
Ive followed each step close and everythingyou said is find, untill i come to compilem and it stops, gives me a browse path for the file. see attached image:
I even replaced the DLL file. haha, i have no idea mate. Im going to try it with delphi6 later today when i get in from work, then reinstall delphi7 incase something messed up or its conflicting with some of my million components haha.
Thankyou so much, your so helpful and thats what makes experts exhange a pleasure to get help from.
Oh by the way, i couldn't even get ur example to work, so itmust be a problem with the objects.
Ill try sys-restore tonight and then re-add the components..
Is there a patch because they seem expensive, and im only ever going to be logging in to mySql.
well, any user tat gets my client, if they are registerd to my site, they can login via the delphi app.
ASKER
ASKER
Geert, sorry it's MySQL mate.
If i can find another way to just, have my users login if they are registered, its perfect.
even if its free components the better.
Anyway would do.
If i can find another way to just, have my users login if they are registered, its perfect.
even if its free components the better.
Anyway would do.
ASKER
Also, im running MySQL ona dedicated server. All i need is when someone types in username and password it checks to make sure they are registered. If they are, show message connected, if not, show not connected.
ASKER
Just an update lads.
Tested on my main PC, and all is good. Works great. I want to thankyou for staying up late last night and helping me though this. FIRST CLASS MATE.
Amazing examples, great service and a credit to EE.
Now, its working perfect, few errors that ill sort out. However, i just checked and whoo!!! i can't afford to buy them!
Is there a patch or something,? Normally id buy them, but i only need it to connect and login. Or is there a way around it?
Thanks
Tested on my main PC, and all is good. Works great. I want to thankyou for staying up late last night and helping me though this. FIRST CLASS MATE.
Amazing examples, great service and a credit to EE.
Now, its working perfect, few errors that ill sort out. However, i just checked and whoo!!! i can't afford to buy them!
Is there a patch or something,? Normally id buy them, but i only need it to connect and login. Or is there a way around it?
Thanks
Glad i've helped.
I have the old version. (Better that the new one i think)
Anyway that version was free but when RemObject bought AnyDAC ...the old version was lost.
Just send me an email or post here your email to send you the old version.
My email is in my profile.
I have the old version. (Better that the new one i think)
Anyway that version was free but when RemObject bought AnyDAC ...the old version was lost.
Just send me an email or post here your email to send you the old version.
My email is in my profile.
Thanks CPColin.
@966
My mail is :
kenny22a @ hotmail . com
@966
My mail is :
kenny22a @ hotmail . com
ASKER
Amazing..
For another, you need to have the LogOn form called as the first thing that happens in the OnShow event of the main form. Then the LogOn form needs to return a true/false indication as to whether it successfully logged on. Based on that true/false result, you can either go ahead and do whatever the main form does or you can exit the application.