|
-
Jun 29th, 2005, 08:21 AM
#1
Thread Starter
Hyperactive Member
MySQL And VB
Hi, I have the MySQL ODBC Driver for connecting to a MySQL Database in Visual Basic. I will be having about 30 individual databases which normally would mean manually setting up 30 ODBC Connections on each of our 50-60 pc's. Is there an easier way of doing this? Since all my connection strings are coded in the programs as follows:
VB Code:
cn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=DATABASE=DataBase_Name;DESCRIPTION=MySQL NCMR Database;DSN=DSN_NAME;OPTION=àà z;PORT=0;SERVER=192.168.50.4;UID=brandone"
Is it possibly to just have one ODBC DSN on each PC that could handle all 30 programs?
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Jul 1st, 2005, 05:10 AM
#2
Addicted Member
Re: MySQL And VB
The option is to create db connections within the code:
Connection to local MySQL database using MySQL ODBC 3.51 Driver
"Provider=MSDASQL; DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=Your_MySQL_Database; UID = Your_Username; PASSWORD=Your_Password; OPTION=3"
(Ref:http://www.sqlstrings.com/MySQL-connection-strings.htm)
In such a case you do not need to configure the dsn on each PC.
-
Jul 1st, 2005, 08:37 AM
#3
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Jul 1st, 2005, 10:18 AM
#4
Thread Starter
Hyperactive Member
Re: MySQL And VB
I see now, Thank you!. So DSNs are mostly for people that use the ADODC/DAO Controls instead of ADO coding in vb?
Last edited by LostAngel; Jul 1st, 2005 at 10:24 AM.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Jul 1st, 2005, 01:11 PM
#5
Re: MySQL And VB
DSN's were the original method used to work with ODBC, but DSN-less connections have since been enabled. DSN's have effectively been depreciated, as they are an unnescessary part of the setup process.
You can still use DSN's if you like, but DSN-less connections are much more flexible, especially if your program can connect to multiple databases.
I haven't tried it, but I'd expect that data controls allow DSN-less connections too.
-
Jul 1st, 2005, 07:13 PM
#6
Re: MySQL And VB
 Originally Posted by LostAngel
I see now, Thank you!. So DSNs are mostly for people that use the ADODC/DAO Controls instead of ADO coding in vb?
Read this: Why Data Binding and the like are evil
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Jul 1st, 2005, 07:57 PM
#7
Thread Starter
Hyperactive Member
Re: MySQL And VB
 Originally Posted by Mark Gambo
Thanks, i've read that many times and have that hanging on my office wall lol. I always use hard coding instead of the ADODBC Control, but have always used DSNs for some reason. I think pretty much the first 'connectionstring' I saw, had a DSN in it and I always kept that format..but thanks to pranoy, I have one that is GREAT.
Code:
If LostAngel.Tag = "Programming" then
LostAngel.Caption = "Awake"
Else
LostAngel.Caption = "Dreaming of Code"
End If
-
Jul 1st, 2005, 09:05 PM
#8
Re: MySQL And VB
 Originally Posted by LostAngel
Thanks, i've read that many times and have that hanging on my office wall lol. I always use hard coding instead of the ADODBC Control, but have always used DSNs for some reason. I think pretty much the first 'connectionstring' I saw, had a DSN in it and I always kept that format..but thanks to pranoy, I have one that is GREAT.
Also take a look at www.connectionstrings.com
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|