C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 26th, 2003, 10:44 AM
4dr14n's Avatar
4dr14n 4dr14n is offline
Huh?
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Scotland, UK
Posts: 223 4dr14n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 3 h 58 m 35 sec
Reputation Power: 6
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

Reply With Quote
  #2  
Old June 26th, 2003, 01:25 PM
dcaillouet's Avatar
dcaillouet dcaillouet is offline
Big Endian
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2001
Location: Fly-over country
Posts: 1,173 dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level)dcaillouet User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 16 h 29 m 5 sec
Reputation Power: 24
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

Reply With Quote
  #3  
Old June 27th, 2003, 08:00 AM
4dr14n's Avatar
4dr14n 4dr14n is offline
Huh?
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: Scotland, UK
Posts: 223 4dr14n User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 3 h 58 m 35 sec
Reputation Power: 6
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?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > using ADOConnection with params set at runtime


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway