[Mono-list] Include error

ccesario ccesario@isic.com.br
Tue, 01 Oct 2002 21:11:25 +0000


Hi!
Can somebody tell me how to make an include to be compiled with the index 
file? 

for example.
I have following code: 

 ---------------------------
index.aspx 

<%@ Page Language="C#" %>
<%@ import namespace="System.Data" %>
<%@ import namespace="System.Data.SqlClient" %>
<html>
<script runat="server" language="C#">
   void Page_Load (object sender, EventArgs e)
	{		
	    <!--#include file="include.aspx"-->
	}
</script> 

<head>
<title>Some DB testing</title>
</head>
<body>
<form runat=server>
<asp:label id="lbl1" Text="No changed" runat="server"/>
</form>
</body>
</html> 

 -----------------------------
include.aspx 

SqlConnection cnc;
int count = 0;
cnc = new SqlConnection ();
string connectionString = "hostaddr=192.168.1.17;" +
					  "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 alunos";
selectCommand.CommandText = selectCmd;
reader = selectCommand.ExecuteReader ();
lbl1.Text = "Executed ";
Response.Write("Id     Nome        Nota" + "<br>");
while (reader.Read ()) {
Response.Write (reader.GetValue(0).ToString() + "  -   " + 
reader.GetValue(1).ToString() + "  -  " + reader.GetValue(2).ToString() + 
"<br>");
count++;
}
Response.Write("<br>");
Response.Write(count + " register(s)" + "<br>");
cnc.Close();
} 

 ---------------------------------------- 

but nothing it happens :( 

I'd like to know which would be the correct way this operation to function. 

greets 

Carlos Cesario