|
-
Oct 19th, 2005, 11:20 PM
#1
Thread Starter
Registered User
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:
Dim mysqlconnect As New System.Data.SqlClient.SqlConnection
mysqlconnect.ConnectionString = "database=MyPlayShop;server=______;UID=____;PASSWORD=___"
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?
-
Oct 21st, 2005, 09:38 AM
#2
Frenzied Member
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!
-
Oct 21st, 2005, 12:44 PM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|