[Mono-list] DataBinding
Jones, Larry
LJones@Lithonia.com
Fri, 2 May 2003 01:14:44 -0700
Gonzalo,
I am not real familiar with BugZilla, so I will give you the data here.
I rewrote the aspx page to use the generic Pubs database, and Authors =
table.
Here it is:
------------------------------------------------------------------------=
----
-------------------
<%@ Page Language=3D"C#" %>
<%@ Import Namespace=3D"System" %>
<%@ Import Namespace=3D"System.Data" %>
<%@ Import Namespace=3D"System.Data.SqlClient" %>
<script runat=3D"server">
public void Page_Load(Object Sender, EventArgs e)
{
SqlDataReader reader;
string connectionString =3D=20
"Server=3DHYDAPPS1;" +
"Database=3Dpubs;" +
"User ID=3Dsa;" +
"Password=3Dbo23zo;";
SqlConnection dbcon;
dbcon =3D new SqlConnection(connectionString);
dbcon.Open();
SqlCommand dbcmd =3D dbcon.CreateCommand();
string sql =3D=20
"SELECT au_fname, au_lname " +
"FROM Authors";
dbcmd.CommandText =3D sql;
reader =3D dbcmd.ExecuteReader();
dgAuthors.DataSource =3D reader;
dgAuthors.DataBind();
// clean up
reader.Close();
dbcon.Close();
}
</script>
<Html>
<Body>
<H2>Testing Sql</H2>
<form runat=3D"server">
<asp:DataGrid ID=3D"dgAuthors" runat=3D"Server" =
AutoGenerateColumns=3D"False" >
<Columns>
<asp:BoundColumn DataField=3D"au_fname" />
<asp:BoundColumn DataField=3D"au_lname" />
</Columns>
</asp:DataGrid>
</form>
</Body>
</Html>
------------------------------------------------------------------------=
----
-------------------
The aspx page above run fine, exactly as is, on IIS 5.0, but hangs
indefinitely on Mono.
The next aspx page runs fine, exactly the same, on both IIS 5.0 and =
Mono. I
have shown this as proof that there is nothing wrong with the =
connection to
MS Sql Server.
------------------------------------------------------------------------=
----
-------------------
<%@ Page Language=3D"C#" %>
<%@ Import Namespace=3D"System" %>
<%@ Import Namespace=3D"System.Data" %>
<%@ Import Namespace=3D"System.Data.SqlClient" %>
<script runat=3D"server">
public void Page_Load(Object Sender, EventArgs e)
{
SqlDataReader reader;
string connectionString =3D=20
"Server=3DHYDAPPS1;" +
"Database=3Dpubs;" +
"User ID=3Dsa;" +
"Password=3Dbo23zo;";
SqlConnection dbcon;
dbcon =3D new SqlConnection(connectionString);
dbcon.Open();
SqlCommand dbcmd =3D dbcon.CreateCommand();
string sql =3D=20
"SELECT au_fname, au_lname " +
"FROM Authors";
dbcmd.CommandText =3D sql;
reader =3D dbcmd.ExecuteReader();
while(reader.Read()) {
string FirstName =3D reader["au_fname"].ToString();
string LastName =3D reader["au_lname"].ToString();
Response.Write("Name: " +=20
FirstName + " " + LastName + "<p>");
}
// clean up
reader.Close();
dbcon.Close();
}
</script>
<Html>
<Body>
<H2>Testing Sql</H2>
</Body>
</Html>
------------------------------------------------------------------------=
----
-------------------
So the problem seems to be in the DataBind of the SQL Server.
Hope this helps.
Larry Jones
Hydrel/Lithonia Lighting
-----Original Message-----
From: Gonzalo Paniagua Javier [mailto:gonzalo@ximian.com]
Sent: Thursday, May 01, 2003 6:50 PM
To: mono-list@lists.ximian.com
Subject: Re: [Mono-list] DataBinding
El jue, 01 de 05 de 2003 a las 02:51, Jones, Larry escribi=F3:
> I got a test MS Sql access going in an ASP.NET (.aspx) page by doing
> response.writes. But when I tried to DataBind it to a DataList or
Datagrid,
> it would fail or hang. I could run the exact same program on a IIS =
5.0
> Server with the same Sql Data base accessed and it runs fine. So
something
> is wrong with the .aspx DataBinding.
Of course, if you have a (small) test case that reproduces the bug, =
I'll
be glad to see it in bugzilla ;-).
If you fill a bug report about this, I'd like to get: the aspx page, =
the
definition of the MS SQL database/table and some data to load into the
table.
It would also be nice if you can test this against current CVS.
Thanks in advance.
-Gonzalo
_______________________________________________
Mono-list maillist - Mono-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list