Results 1 to 3 of 3

Thread: Connection to MySQL

  1. #1

    Thread Starter
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336

    Connection to MySQL

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

    VB Code:
    1. Imports System.Data.OleDb
    2. Public Class specialeventinfo
    3.     Inherits System.Web.UI.Page
    4.     Protected WithEvents Text1 As System.Web.UI.HtmlControls.HtmlInputText
    5.     Protected WithEvents txtEventInfo As System.Web.UI.HtmlControls.HtmlTextArea
    6.  
    7.  
    8.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    9.  
    10.         If Application("Connection") Is Nothing Then
    11.             Dim MySQLConn As OleDbConnection, ConString As String
    12.             Try
    13.                 ConString = "Provider=MySQL;Data Source=111.11.111.11;Initial Catalog=wild;User ID=uid;Password=pwd;"
    14.                 MySQLConn = New OleDbConnection(ConString)
    15.                 MySQLConn.Open()
    16.             Catch ex As Exception
    17.                 Response.Write("Connection Error")
    18.             End Try
    19.         End If
    20.     End Sub
    21.  
    22. End Class

    Thanks!
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  2. #2

    Thread Starter
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    I've also tried using the Microsoft.Data.ODbc namespace to no avail...

    VB Code:
    1. Imports Microsoft.Data.Odbc
    2. Public Class specialeventinfo
    3.     Inherits System.Web.UI.Page
    4.     Protected WithEvents Text1 As System.Web.UI.HtmlControls.HtmlInputText
    5.     Protected WithEvents txtEventInfo As System.Web.UI.HtmlControls.HtmlTextArea
    6.  
    7.  
    8.     Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    9.  
    10.         If Application("Connection") Is Nothing Then
    11.             Dim MySQLConn As OdbcConnection, ConString As String
    12.             Try
    13.                 ConString = "Driver={MySQL ODBC 3.51 Driver};Server=11.11.11.11;Database=wild;uid=uid;pwd=pwd;option=3"
    14.  
    15.                 MySQLConn = New OdbcConnection(ConString)
    16.                 MySQLConn.Open()
    17.             Catch ex As Exception
    18.                 Response.Write("Connection Error")
    19.             End Try
    20.         End If
    21.     End Sub
    22.  
    23. 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
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


  3. #3
    New Member
    Join Date
    Mar 2003
    Posts
    9
    Brad

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