Hi all,

I transfered my mssql database to a mysql database (different webhost). It was difficult but I succeeded. Yeeh!
Now I need to use a ODBC Connection. My webhost gave me the connectionstring below, however my webpage gives the following error:
System.ArgumentException: Keyword not supported: 'driver'.

I think I have to adjust my code. I already changed SqlConnection into OdbcConnection, SqlCommand into OdbcCommand etc.
Could someone please help me? (I am new to programming)

The code I've got so far:
Imports Microsoft.Data.Odbc
Imports System.Data

Partial Class Bedrijvenindex
Inherits System.Web.UI.Page

Sub drpCategorie_SelectedIndexChanged(ByVal s As Object, ByVal e As EventArgs)
adsrechts.Visible = "true"
'geselecteerde CategorieID uitlezen
Dim intCategorieID As Integer = drpCategorie.SelectedItem.Value
'verbinding maken met de database en juiste bedrijven ophalen
Dim conBedrijf As OdbcConnection
Dim ConnectionString As String = "Driver={MySQL ODBC 5.1 Driver};Server=***;Database=***;User=***; Password=***;Option=3;"

Dim cmdSelectBedrijf As OdbcCommand
Dim OdbcString As String
conBedrijf = New OdbcConnection(ConnectionString)
OdbcString = "SELECT * from Bedrijf WHERE CategorieID="
OdbcString &= intCategorieID

If intCategorieID = "6" Then OdbcString = "SELECT * from Bedrijf"
If intCategorieID = "0" Then OdbcString = "SELECT * from Bedrijf WHERE CategorieID=0"
If intCategorieID = "0" Then adsrechts.Visible = "false"

Dim dtrBedrijf As OdbcDataReader
conBedrijf = New OdbcConnection(ConnectionString)
cmdSelectBedrijf = New OdbcCommand(OdbcString, conBedrijf)
dtrBedrijf = cmdSelectBedrijf.ExecuteReader()

'opgehaalde gegevens binden aan repeater
rptCategorie.DataSource = dtrBedrijf
End Sub

End Class


  • seancampbellseancampbell Pennsylvania, USA
    Chances are you are using the wrong connectionstring, visit this site and pick the connection string that best fits your scenario:


  • Thanks for your reply Sean.

    But according to this page (and my webhost) I must use: Driver={MySQL ODBC 5.1 Driver};Server=myServerAddress;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
    and that is exactly what I'm doing..

    So any other ideas?
  • My webhost told me to ad:

    but now I get the following error:
    Could not load file or assembly 'MySql.Data, Version=, Culture=neutral, PublicKeyToken=C568734FC88979C44D' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)

    How do I solve this?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!