Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET and mySQL

Status
Not open for further replies.

oldwen

Programmer
Dec 2, 2003
23
US
Hello all,

I am trying to connect to a mySQL db using vb.net. I have been unsuccesful. In addition to this, I am growing increasing frustrated at the fact that there is little documentation on this. SOMEONE please help. HOW do you get ASP.NET(VB) and mySQL to work? I have download the odbc driver 3.51, I have a valid connection string and still nothing. Here is my code so far:

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Data.OleDb" %>
<%@ Import Namespace="System.Data.Odbc" %>
<script runat="server">
Dim MyConnString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
"SERVER=localhost;" & _
"DATABASE=dscimedia;" & _
"UID=root;" & _
"PASSWORD=visionary;" & _
"OPTION=3;"

Dim mySelectQuery As String = "SELECT * FROM general_generaltopics"
Dim myConnection As New OdbcConnection(myConnString)
Dim myCommand As New OdbcCommand(mySelectQuery, myConnection)
myConnection.Open()
myConnection.Close()
Response.Write("It worked")
</script>

I can not get this to work.
 
Hi oldwen,

Have you created an ODBC datasource that your connection string points to?
 
Oh yeah another quick thing to check,

Before your page class, reference the namespace for the driver like:

Imports.Microsoft.Data.Odbc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top