[Mono-list] DataBinding

Jones, Larry LJones@Lithonia.com
Fri, 2 May 2003 01:13:53 -0700

Here is the aspx code:


<%@ Page Language="C#" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>

<script runat="server">
public void Page_Load(Object Sender, EventArgs e)
	SqlDataReader reader;
       string connectionString = 
          "Server=SERVER;" +
          "Database=SpecReg;" +
          "User ID=sa;" +
       SqlConnection dbcon;
       dbcon = new SqlConnection(connectionString);
       SqlCommand dbcmd = dbcon.CreateCommand();
       string sql = 
           "SELECT Agent_Nbr, Agent_Name " +
           "FROM Agents";
       dbcmd.CommandText = sql;
       reader = dbcmd.ExecuteReader();
//       while(reader.Read()) {
//            string AgentNbr = reader["Agent_Nbr"].ToString();
//            string AgentName = reader["Agent_Name"].ToString();
//            Response.Write("Agent Nbr: " + 
//                 AgentNbr + " Agent Name: " + AgentName);
//       }

	dgAgents.DataSource = reader;

       // clean up
<H2>Testing Sql</H2>
<form runat="server">

<asp:DataGrid ID="dgAgents" runat="Server" AutoGenerateColumns="True">




The commented out section of cs code is where I was able to verify the
connection and print data with response.writes.  I also tried a not
AutoGenerateColumns version with bound colums and that didn't work either.
I can copy this exact same aspx file and put it in an IIS 5.0 directory on
the same intranet and it runs fine.  But not on my Linux RedHat 8.0 box.

Larry Jones
Hydrel/Lithonia Lighting

-----Original Message-----
From: Daniel Morgan [mailto:danmorg@sc.rr.com]
Sent: Thursday, May 01, 2003 8:27 AM
To: Jones, Larry; mono-list@ximian.com
Subject: RE: [Mono-list] DataBinding

Do you have the .cs or .aspx source?  Can you provide more info?

-----Original Message-----
From: mono-list-admin@lists.ximian.com
[mailto:mono-list-admin@lists.ximian.com]On Behalf Of Jones, Larry
Sent: Wednesday, April 30, 2003 8:51 PM
To: 'mono-list@ximian.com'
Subject: [Mono-list] DataBinding

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.

Larry Jones
Hydrel/Lithonia Lighting
Mono-list maillist  -  Mono-list@lists.ximian.com