[Mono-list] xsp and bytefx(2)

Timothy Parez tpsoftware@users.sourceforge.net
Sat, 23 Aug 2003 13:26:26 +0200


Try

MySqlConnection instead of  MySQLConnection
----- Original Message ----- 
From: "danilo lujambio" <danilo@tau.org.ar>
To: "Gonzalo Paniagua Javier" <gonzalo@ximian.com>
Cc: <mono-list@lists.ximian.com>
Sent: Saturday, August 23, 2003 1:03 PM
Subject: Re: [Mono-list] xsp and bytefx(2)


> El s?, 23-08-2003 a las 07:34, Gonzalo Paniagua Javier escribió:
> sorry but now I have :
>
> /tmp/tmp69fc5893.cs(53,0) : error CS0246: Cannot find type
> `MySQLConnection'
> /tmp/tmp69fc5893.cs(54,0) : error CS0165: Use of unassigned local
> variable `dbcon'
> /tmp/tmp69fc5893.cs(87,0) : error CS0103: The name `myConn' could not be
> found in `ASP.webmysql_aspx'
>
> and my test webform is:
>
> <%@ Page Language="C#" %>
> <%@ import namespace="System.Data" %>
> <%@ assembly name="ByteFX.Data" %>
>
>
>
> <script runat="server">
>
> void Page_Load(Object sender, EventArgs e)
> {
>
>        string connectionString =
>           "Server=localhost;" +
>           "Database=mibase;" +
>           "User ID=miusuario;" +
>           "Password=mipasswd;";
>        IDbConnection dbcon;
>
>     //use try/catch because we may fail to connect
>     try
>     {
>
>        dbcon = new MySQLConnection(connectionString);
>        dbcon.Open();
>     //we connected!
>     lblConnectInfo.Text = "Connection successful!";
>        IDbCommand dbcmd = dbcon.CreateCommand();
>
>        string sql =
>            "SELECT Direccion, Provincia " +
>            "FROM Cabina";
>        dbcmd.CommandText = sql;
>        IDataReader reader = dbcmd.ExecuteReader();
>        while(reader.Read()) {
>             string FirstName = (string) reader["Direccion"];
>             string LastName = (string) reader["Provincia"];
>
>     lblConnectInfo.Text = FirstName;
>     lblConnectInfo.Text = LastName;
> }
>
>        reader.Close();
>        reader = null;
>        dbcmd.Dispose();
>        dbcmd = null;
>        dbcon.Close();
>        dbcon = null;
>     //do something and then be sure to close the connection...
>     }
>     catch
>     {
>     //was your connection string correct?
>     lblConnectInfo.Text = "Connection failed!";
>     }
>     finally
>     {
>     if (myConn != null)
>     myConn.Close();
>     }
> }
> </script>
> <html>
> <head>
> <title>Recipe1004cs</title>
> </head>
> <body>
> <form id="Recipe1004csForm" method="post" runat="server">
> This page simply tries (and fails) to open an MySql connection.
> <asp:Label id="lblConnectInfo" runat="server"></asp:Label>
> </form>
> </body>
> </html>
>
>
>
> > El sáb, 23-08-2003 a las 12:35, danilo lujambio escribió:
> > > Hi,
> > >
> > > I made a test program in C# to connect to mysql database using bytefx
> > > and it worked OK. Then I tried to por the same program to webform and
I
> > > tested it with xsp.
> > >
> > > I could not pass this step:
> > >
> > > The namespace `ByteFX.Data' can not be found
> > >
> > > I probed with :
> > > <%@ Page Language="C#" %>
> > > <%@ import namespace="System.Data" %>
> > > <%@ import namespace="ByteFX.Data" %>
> >
> > You need:
> > <%@ assembly name="ByteFX.Data" %>
> >
> >
> > -Gonzalo
> >
> >
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
>
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003