Results 1 to 8 of 8

Thread: MySQL And VB

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    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:
    1. 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

  2. #2
    Addicted Member
    Join Date
    Jun 2005
    Posts
    139

    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.

  3. #3
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: MySQL And VB

    Take a look at this link
    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."


  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    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

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    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.

  6. #6
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: MySQL And VB

    Quote 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."


  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2003
    Posts
    419

    Re: MySQL And VB

    Quote 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

  8. #8
    Giants World Champs!!!! Mark Gambo's Avatar
    Join Date
    Sep 2003
    Location
    Colorado
    Posts
    2,965

    Re: MySQL And VB

    Quote 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
  •  



Click Here to Expand Forum to Full Width