List:MySQL and .NET« Previous MessageNext Message »
From:Eduardo Fujii Date:September 21 2004 6:06pm
Subject:How to configure .Net to use MySQL Connector/Net provider ?
View as plain text  
Hello All:

I downloaded and installed MySQL Connector/Net 1.0 but have not been able to use in my
aspx page. Any help would be apprecitated as I'm not very familiar with ASP.NET.

Do I need to copy MySql.Data.dll somewhere ? (I did copy it to
C:\WINNT\Microsoft.NET\Framework\v1.1.4322 but no success). I always get the message:
Compiler Error Message: BC30002: Type 'MySqlCommand' is not defined.

My development environment is:
Windows XP Professional Version 5.1 Service Pack 1
IIS 5.1
.Net Framework 1.1
MySQL 3.23.33 running on Solaris 7

Here is the aspx test page:

<%@ page language="VB" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="MySql.Data.MySqlClient" %>
<html>
   <head>
        <script language="VB" runat="server">

            Sub Page_Load(Sender As Object, E As EventArgs)
                 Dim myConnectionStr as String = "Database=mydatabase;Data
Source=myhostname;User Id=mylogin;Password=mypassword"
                 Dim myCommand As IdbCommand = new MySqlCommand("select * from
perpetrators", myConnectionStr)
                 myConnection.Open()
                 Dim dr As MySqlDataReader = myCommand.ExecuteReader()
                 MyDataGrid.DataSource = dr
                 MyDataGrid.DataBind()
                 myConnection.Close()
                End Sub
</script>
</head>

   <body>
<ASP:DataGrid id="MyDataGrid" runat="server"
    Width="700"
    BackColor="#ccccff" 
    BorderColor="black"
    ShowFooter="false" 
    CellPadding=3 
    CellSpacing="0"
    Font-Name="Verdana"
    Font-Size="8pt"
    HeaderStyle-BackColor="#aaaadd"
    EnableViewState="false"
  />

   </body>
</html>

Thread
How to configure .Net to use MySQL Connector/Net provider ?Eduardo Fujii21 Sep