List:MySQL ODBC« Previous MessageNext Message »
From:Marko Ludolph Date:December 21 2005 10:47am
Subject:Problems with MyODBC and ASP.NET 2.0
View as plain text  
Hi,

after creating my asp application (C#) with access as database, I want
to do the final step and use MySQL. But I have strange problems using
the ODBC-Connector.

Here is a small example:

The ASP-Code:

        <asp:SqlDataSource
            ID="SqlDataSource1"
            runat="server"
            ConnectionString="DRIVER={MySQL ODBC 3.51
Driver};SERVER=localhost;DATABASE=scanner;USER=root;PASSWORD=mysql;OPTION=3;"
            ProviderName="System.Data.Odbc"
            SelectCommand="SELECT Kit_ID FROM
scanner.kit_konfiguration WHERE Kit_ID > @ID">

            <SelectParameters>
                <asp:Parameter Type="int32" Name="ID" />
            </SelectParameters>

        </asp:SqlDataSource>

I only create a datasource with a select statement, and one parameter
(@ID). But when setting the ID within C#, the database only returns 0
rows, here is the C#-Code:

    protected void Page_Load(object sender, EventArgs e)
    {
        SqlDataSource1.SelectParameters["ID"].DefaultValue = "0";
    }

All this code works fine using access.

Software:
Latest ODBC Connector 3.51.12 and MySQL 4.1.13 on Windows XP Home
Edition SP2 + all updates available.

Could anyone help me?

Regards
Marko
Thread
Problems with MyODBC and ASP.NET 2.0Marko Ludolph21 Dec