Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

OleDbDataReader

  Asked By: Hamish    Date: Feb 07    Category: Asp.net    Views: 596
  

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>

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Faeezah Khan     Answered On: Feb 07

You seem to have inputted your connection where your SQL statement  should be - yet your VB is correct ????? - go and have a cup of tea and a ciggy and mellow out for 10 mins. On top of that your obviously going blind.

Hope this helps

OleDbCommand Cmd = new OleDbCommand(strConn, Conn);

 
Didn't find what you were looking for? Find more on OleDbDataReader Or get search suggestion and latest updates.

Related Topics:



Tagged:  

 
 
 

Related Post