Results 1 to 3 of 3

Thread: MYSQL ASP.NET Connecting

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2000
    Posts
    52

    MYSQL ASP.NET Connecting

    We have a hosting site a god*ddy. I have a MYSQL database setup and I have the host name and a DSN setup on their site. I am working in VB.NET. I want to connect to the MYSQL database. What is the syntax for that? I tried the following:
    VB Code:
    1. Dim mysqlconnect As New System.Data.SqlClient.SqlConnection
    2. mysqlconnect.ConnectionString = "database=MyPlayShop;server=______;UID=____;PASSWORD=___"
    3. mysqlconnect.Open()

    Any ideas why it won't open. I'm not sure of the context for opening it with the DSN. But I think the above should connect me?

  2. #2
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131

    Re: MYSQL ASP.NET Connecting

    You are using a SqlConnection and presumably other objects from the System.Data.SqlClient namespace. To connect to a MySQL database you need to use ODBC and therefore an OdbcConnection and objects from the System.Data.Odbc namespace.

    Your connection string should work but if you want to use a DSN the format is:
    "DSN=myDsn;Uid=username;Pwd=password;"
    where myDSN is the name of your DSN and you change username and password as required.

    HTH

    DJ

    If I have been helpful please rate my post. If I haven't tell me!

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: MYSQL ASP.NET Connecting

    You'll also need to find out which provider your host supports, because there are several .net providers for MySQL. You can then get your connectionstring from www.connectionstrings.com

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