PDA

Click to See Complete Forum and Search --> : Connection to MySQL


Arc
Jun 12th, 2003, 06:56 AM
Hi, What would the Provider name be for a MySQL DB? I'm using the oledb connection type and must provide a provider name and i have no idea what to put as the provider for MySQL.

Here's the code i have but it no worky...


Imports System.Data.OleDb
Public Class specialeventinfo
Inherits System.Web.UI.Page
Protected WithEvents Text1 As System.Web.UI.HtmlControls.HtmlInputText
Protected WithEvents txtEventInfo As System.Web.UI.HtmlControls.HtmlTextArea


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Application("Connection") Is Nothing Then
Dim MySQLConn As OleDbConnection, ConString As String
Try
ConString = "Provider=MySQL;Data Source=111.11.111.11;Initial Catalog=wild;User ID=uid;Password=pwd;"
MySQLConn = New OleDbConnection(ConString)
MySQLConn.Open()
Catch ex As Exception
Response.Write("Connection Error")
End Try
End If
End Sub

End Class


Thanks!:D

Arc
Jun 12th, 2003, 03:33 PM
I've also tried using the Microsoft.Data.ODbc namespace to no avail...


Imports Microsoft.Data.Odbc
Public Class specialeventinfo
Inherits System.Web.UI.Page
Protected WithEvents Text1 As System.Web.UI.HtmlControls.HtmlInputText
Protected WithEvents txtEventInfo As System.Web.UI.HtmlControls.HtmlTextArea


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If Application("Connection") Is Nothing Then
Dim MySQLConn As OdbcConnection, ConString As String
Try
ConString = "Driver={MySQL ODBC 3.51 Driver};Server=11.11.11.11;Database=wild;uid=uid;pwd=pwd;option=3"

MySQLConn = New OdbcConnection(ConString)
MySQLConn.Open()
Catch ex As Exception
Response.Write("Connection Error")
End Try
End If
End Sub

End Class


I get this error...

Microsoft.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified at Microsoft.Data.Odbc.OdbcConnection.Open() at OptimaBackEndTest.specialeventinfo.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\OptimaBackEndTest\specialeventinfo.aspx.vb:line 33

BradRoberts
Jun 13th, 2003, 02:21 PM
Try looking here:

http://aspwire.com/brief.asp?7410