[Mono-list] Re: Xsp + Postgres error!

ccesario ccesario@isic.com.br
Sun, 22 Sep 2002 08:56:25 +0000


Alejandro Sánchez, 

I changed..language="c#" for ..language="C#" in previous tests and also he 
did not function...
I made some possible tests, and two friends mine had also made some tests 
and they had not gotten no result.
As I said previously... I seem that the Page_Load event is not functioning.
The example two is in http://200.206.158.45/dd.aspx 

Some suggestion? 

Thanks 

Carlos Cesario 

 

Alejandro Sánchez writes: 

> 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="c#"" and mono is case sensitive and only recognized
> the name of language in uppercase: "C#".I would test only <script
> runat=server> or <script runat=server language="C#">. 
> 
> If nothing of this work, maybe would be a bug in Page_Load because if
> only the connection fails lbl.Text="error..." and the Text of the label
> changes. 
> 
> Cheers 
> 
> -- Alex 
> 
> El sáb, 21-09-2002 a las 21:56, ccesario escribió:
>> Hey friends,
>>    I'm trying to do a test using xsp + postgres and I ain't getting any 
>> results.
>>    I already tried several ways of doing it, mono doesn't show any errors, 
>> but I can't see any results either. I have the following table in Postgres:  
>> 
>>    Aluno
>>       id   int8
>>       nome varchar(30)
>>       nota float  
>> 
>> I tried the following code snippets:  
>> 
>>  -----------------------------------  
>> 
>> <%@ Page Language="C#"  Debug="true" %>
>> <%@ import namespace="System.Data" %>
>> <%@ import namespace="System.Data.SqlClient" %>
>> <html>
>> <script runat="server" language="c#">  
>> 
>> void Page_Load (object sender, EventArgs e)
>> {
>>    Response.Write("Holy crap");
>>    SqlConnection cnc = new SqlConnection();
>>    cnc.ConnectionString = "Data Source=200.206.158.45:5432;User 
>> ID=ziral;Password=ziral;Initial Catalog=teste;";
>>    cnc.Open ();
>>    string selectCmd = "SELECT * FROM aluno";
>>    SqlCommand selectCommand = cnc.CreateCommand();
>>    selectCommand.CommandText = selectCmd;
>>    SqlDataReader reader = selectCommand.ExecuteReader();
>>    while (reader.Read ()) {
>>        Response.Write (reader.GetString(0) + ", " + reader.GetString(1));
>>    }
>>    reader.Close();
>>    cnc.Close();
>> }  
>> 
>> </script>  
>> 
>> <head>
>> <title>Some DB testing</title>
>> </head>
>> <body>
>> <form runat=server>
>> <asp:label id="lbl1" Text="No changed" runat="server"/>
>> </form>
>> </body>
>> </html>  
>> 
>>  -------------------------------------------------------  
>> 
>> <%@ Page Language="C#"  Debug="true" %>
>> <%@ import namespace="System.Data" %>
>> <%@ import namespace="System.Data.SqlClient" %>
>> <html>
>> <script runat="server" language="c#">
>>        void Page_Load (object sender, EventArgs e)
>>        {
>>                SqlConnection cnc;  
>> 
>>                cnc = new SqlConnection ();
>>                string connectionString = "hostaddr=200.206.158.45;" +
>>                                          "PORT=5432;" +
>>                                          "user=ziral;" +
>>                                          "password=ziral;" +
>>                                          "dbname=teste";  
>> 
>>                cnc.ConnectionString = connectionString;
>>                try {
>>                      cnc.Open ();
>>                      lbl1.Text = "Connected: ";
>>                } catch (Exception e2) {
>>                      lbl1.Text = "The error was: " + e2.Message;
>>                }
>>                IDbCommand selectCommand = cnc.CreateCommand();
>>                IDataReader reader;
>>                if (selectCommand == null)
>>                    lbl1.Text = "Null";
>>                    else
>>                    lbl1.Text = "Not Null";  
>> 
>>                string selectCmd = "SELECT * FROM aluno";
>>                selectCommand.CommandText = selectCmd;
>>                reader = selectCommand.ExecuteReader ();
>>                lbl1.Text = "Executed ";
>>                while (reader.Read ()) {
>>                Response.Write (reader.GetString(0) + ", " + 
>> reader.GetString(1));
>>                }
>>                cnc.Close();
>>        }  
>> 
>> </script>  
>> 
>> <head>
>> <title>Some DB testing</title>
>> </head>
>> <body>
>> <form runat=server>
>> <asp:label id="lbl1" Text="No changed" runat="server"/>
>> </form>
>> </body>
>> </html>  
>> 
>>  -----------------------  
>> 
>> 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  
>> 
>>   
>> 
>> Thanks in advance,  
>> 
>> Carlos Cesario 
>> 
>> _______________________________________________
>> Mono-list maillist  -  Mono-list@ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-list 
>> 
>