[Mono-list] Xsp + Postgres error!

Alejandro Sánchez raciel@x0und.net
22 Sep 2002 04:27:12 +0000


--=-WnS6Br+nOyOyPrHe6faR
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

Hi!

What is the sample of the aspx code? the first or the second? In the
first you dont modify the label.Text when your page is load so that the
label.Text is "No changed" and in the second sample all the code seems
to be nice.

The only thing that I see a trouble is that you have used in the section
<script> "language=3D"c#"" and mono is case sensitive and only recognized
the name of language in uppercase: "C#".I would test only <script
runat=3Dserver> or <script runat=3Dserver language=3D"C#">.

If nothing of this work, maybe would be a bug in Page_Load because if
only the connection fails lbl.Text=3D"error..." and the Text of the label
changes.

Cheers

-- Alex

El s=E1b, 21-09-2002 a las 21:56, ccesario escribi=F3:
> Hey friends,
>    I'm trying to do a test using xsp + postgres and I ain't getting any=20
> results.
>    I already tried several ways of doing it, mono doesn't show any errors=
,=20
> but I can't see any results either. I have the following table in Postgre=
s:=20
>=20
>    Aluno
>       id   int8
>       nome varchar(30)
>       nota float=20
>=20
> I tried the following code snippets:=20
>=20
>  -----------------------------------=20
>=20
> <%@ Page Language=3D"C#"  Debug=3D"true" %>
> <%@ import namespace=3D"System.Data" %>
> <%@ import namespace=3D"System.Data.SqlClient" %>
> <html>
> <script runat=3D"server" language=3D"c#">=20
>=20
> void Page_Load (object sender, EventArgs e)
> {
>    Response.Write("Holy crap");
>    SqlConnection cnc =3D new SqlConnection();
>    cnc.ConnectionString =3D "Data Source=3D200.206.158.45:5432;User=20
> ID=3Dziral;Password=3Dziral;Initial Catalog=3Dteste;";
>    cnc.Open ();
>    string selectCmd =3D "SELECT * FROM aluno";
>    SqlCommand selectCommand =3D cnc.CreateCommand();
>    selectCommand.CommandText =3D selectCmd;
>    SqlDataReader reader =3D selectCommand.ExecuteReader();
>    while (reader.Read ()) {
>        Response.Write (reader.GetString(0) + ", " + reader.GetString(1));
>    }
>    reader.Close();
>    cnc.Close();
> }=20
>=20
> </script>=20
>=20
> <head>
> <title>Some DB testing</title>
> </head>
> <body>
> <form runat=3Dserver>
> <asp:label id=3D"lbl1" Text=3D"No changed" runat=3D"server"/>
> </form>
> </body>
> </html>=20
>=20
>  -------------------------------------------------------=20
>=20
> <%@ Page Language=3D"C#"  Debug=3D"true" %>
> <%@ import namespace=3D"System.Data" %>
> <%@ import namespace=3D"System.Data.SqlClient" %>
> <html>
> <script runat=3D"server" language=3D"c#">
>        void Page_Load (object sender, EventArgs e)
>        {
>                SqlConnection cnc;=20
>=20
>                cnc =3D new SqlConnection ();
>                string connectionString =3D "hostaddr=3D200.206.158.45;" +
>                                          "PORT=3D5432;" +
>                                          "user=3Dziral;" +
>                                          "password=3Dziral;" +
>                                          "dbname=3Dteste";=20
>=20
>                cnc.ConnectionString =3D connectionString;
>                try {
>                      cnc.Open ();
>                      lbl1.Text =3D "Connected: ";
>                } catch (Exception e2) {
>                      lbl1.Text =3D "The error was: " + e2.Message;
>                }
>                IDbCommand selectCommand =3D cnc.CreateCommand();
>                IDataReader reader;
>                if (selectCommand =3D=3D null)
>                    lbl1.Text =3D "Null";
>                    else
>                    lbl1.Text =3D "Not Null";=20
>=20
>                string selectCmd =3D "SELECT * FROM aluno";
>                selectCommand.CommandText =3D selectCmd;
>                reader =3D selectCommand.ExecuteReader ();
>                lbl1.Text =3D "Executed ";
>                while (reader.Read ()) {
>                Response.Write (reader.GetString(0) + ", " +=20
> reader.GetString(1));
>                }
>                cnc.Close();
>        }=20
>=20
> </script>=20
>=20
> <head>
> <title>Some DB testing</title>
> </head>
> <body>
> <form runat=3Dserver>
> <asp:label id=3D"lbl1" Text=3D"No changed" runat=3D"server"/>
> </form>
> </body>
> </html>=20
>=20
>  -----------------------=20
>=20
> The database is OK, I can use it via psql.
> I think Page_Load event is not being fired
> The page is located in this address http://200.206.158.45/db.aspx=20
>=20
> =20
>=20
> Thanks in advance,=20
>=20
> Carlos Cesario
>=20
> _______________________________________________
> Mono-list maillist  -  Mono-list@ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>=20


--=-WnS6Br+nOyOyPrHe6faR
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje esta firmada digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQA9jUagsgoaWknonh4RAufJAJsGOs4Oiu/9LakMRCm2h0f95dclUwCgvU4L
0KEQcYdmG64FmmU2AdPlbAI=
=kRNy
-----END PGP SIGNATURE-----

--=-WnS6Br+nOyOyPrHe6faR--