P
princeh8
I can connect to SQL Server and read any table data but
can't do so with MS Access 2000 (9.0.2720)
Here is a sample code.
on the webForm.aspx page I have the following web server
control:
<asp:dropdownlist id="roomList" runat="server">
</asp:dropdownlist>
In the webForm.aspx.cs file (the file behind the scenes)
I have the following code..
As a class level variable I have the following:
OleDbConnection conn;
DataSet ds;
OleDbDataAdapter daRooms;
Inside the InitializeComponent() method, I initialize the
connection string as follows:
this.conn = new OleDbConnection();
this.conn.ConnectionString
= "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Inetpub\\wwwroot\\WebApp\\mydatabase.mdb"
Now within the Page_Load() event handler I have..
conn.Open();
daRooms = new OleDbDataAdapter("SELECT * FROM Rooms",
conn);
daRooms.Fill(ds, "Rooms");
roomList.DataSource = ds.Tables["Rooms"];
if(!this.IsPostBack){
this.DataBind();
}
conn.Close();
When I run the application, instead of seeing the room
names within the <asp:dropDownList> control, I see the
following:
System.DataRow.DataView
I see one such line for each room name that is in the
database table, Rooms
Can someone please tell me why? What am I doing wrong?
thanks,
Prince
can't do so with MS Access 2000 (9.0.2720)
Here is a sample code.
on the webForm.aspx page I have the following web server
control:
<asp:dropdownlist id="roomList" runat="server">
</asp:dropdownlist>
In the webForm.aspx.cs file (the file behind the scenes)
I have the following code..
As a class level variable I have the following:
OleDbConnection conn;
DataSet ds;
OleDbDataAdapter daRooms;
Inside the InitializeComponent() method, I initialize the
connection string as follows:
this.conn = new OleDbConnection();
this.conn.ConnectionString
= "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\Inetpub\\wwwroot\\WebApp\\mydatabase.mdb"
Now within the Page_Load() event handler I have..
conn.Open();
daRooms = new OleDbDataAdapter("SELECT * FROM Rooms",
conn);
daRooms.Fill(ds, "Rooms");
roomList.DataSource = ds.Tables["Rooms"];
if(!this.IsPostBack){
this.DataBind();
}
conn.Close();
When I run the application, instead of seeing the room
names within the <asp:dropDownList> control, I see the
following:
System.DataRow.DataView
I see one such line for each room name that is in the
database table, Rooms
Can someone please tell me why? What am I doing wrong?
thanks,
Prince