|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
using ADOConnection with params set at runtime
I am developing an application that requires users to login to a MySQL database. I am using an ADO Connection (for just now. want to change it to SQLConnection later). I have a login screen which asks the user to enter the user name, password and host name to edit boxes. i then want to take the info input here and put it into the connection string for the ADO connection. However, i am not sure how to do this.
I think i have to use: ADOConnection1 -> ConnectionString = ("whatever"); and/or ADOConnection -> Open ("whatever"); The only problem is i dont know what to put into the "whatever" parts of them. I know i get the info from the textboxes using the code: UserNameEnter -> Text; PasswordEnter -> Text; HostNameEnter -> Text; But what do i do with it? How do i put it into the connection string? All help will be appreciated...Believe me... i been going crazy over this for the past few hours!! TIA ![]()
__________________
----------------------------------------------------------- 4dr14n |
|
#2
|
||||
|
||||
|
Try something like this:
Code:
AnsiString sConnect;
sConnect = "Driver={MySQL};Server=";
sConnect += HostNameEnter->Text;
sConnect += ";Database=test;User=";
sConnect += UserNameEnter->Text;
sConnect += ";Password=";
sConnect += PasswordEnter->Text;
sConnect += ";Option=1;";
ADOConnection1->LoginPrompt = false;
ADOConnection1->ConnectionString = sConnect;
ADOConnection1->Open();
The following link was written for Visual C++ but can still be a useful resource. http://www.codeproject.com/database...ction%7Cstrings |
|
#3
|
||||
|
||||
|
thanx!
that helped...good link as well. I have now moved on to the sql connection. Do you think this is a better way of connecting to a MySQL databse or am i better using ADO? |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > using ADOConnection with params set at runtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|