Odbc Help!

rochfan

New member
Joined
Jan 14, 2010
Messages
1
Programming Experience
Beginner
Hi,

I transfered my mssql database to a mysql database (different webhost). It was difficult but I succeeded. Yeeh! (I am new to programming)

Now I need to use a ODBC Connection. My webhost gave me the connectionstring below, then my webpage gave me the following error:
System.ArgumentException: Keyword not supported: 'driver'.
So I asked my webhost again and he told me to add this assembly to my webconfig:

<assemblies>
<add assembly="MySql.Data, Version=6.0.4.0, Culture=neutral, PublicKeyToken=C568734FC88979C44D"/>
</assemblies>

Now I get the following error:
Could not load file or assembly 'MySql.Data\, Version\=6.0.4.0\, 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? (I am new to programming)
Thanks for your help/ideas!

Wendy

PS: My code:

VB.NET:
Imports System
Imports System.Data
Imports System.Data.Odbc

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 MyConString As String = "Driver={MySQL ODBC 5.1 Driver};Server=mysql1.***.nl;Database=***;User=***; Password=***;Option=3;"
        'Connect to MySQL using MyODBC
	Dim MyConnection As OdbcConnection = New OdbcConnection(MyConString)
	Dim cmdSelectBedrijf As OdbcCommand
        Dim SqlString As String
        MyConnection = New OdbcConnection(MyConString)
        MyConnection.Open()
        SqlString = "SELECT * from Bedrijf WHERE CategorieID="
        SqlString &= intCategorieID

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

        Dim dtrBedrijf As OdbcDataReader
        MyConnection = New OdbcConnection(MyConString)
        MyConnection.Open()
        cmdSelectBedrijf = New OdbcCommand(SqlString, MyConnection)
        dtrBedrijf = cmdSelectBedrijf.ExecuteReader()

        'opgehaalde gegevens binden aan repeater
        rptCategorie.DataSource = dtrBedrijf
        rptCategorie.DataBind()
        dtrBedrijf.Close()
        MyConnection.Close()
    End Sub


End Class
 
Back
Top