I really couldnt figure out why I am running into errors. This worked
fine with VB but not C#.
Every statement above Rdr=Cmd.ExecuteReader(); is working fine.
Please help me.
<% @ Page Language="C#" %>
<% @ Import Namespace="System.Data" %>
<% @ Import Namespace="System.Data.OleDb" %>
<html>
<script language="C#" runat="server">
void Page_Load(Object Src,EventArgs E) {
string strConn ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
Server.MapPath("dbase3.mdb") + ";";
string strSQL ="select * from Factory1 order by Period";
OleDbConnection Conn = new OleDbConnection(strConn);
OleDbCommand Cmd = new OleDbCommand(strConn, Conn);
Conn.Open();
OleDbDataReader Rdr;
Rdr=Cmd.ExecuteReader(); <--- error occurred here.
MyDataGrid.DataSource = Rdr;
MyDataGrid.DataBind();
}
</script>
</html>