*************** *****
My code:
*************** *****
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<script language="VB" runat="server">
sub Page_Load(Sende r as Object, e as EventArgs)
'set up connection
dim objConn as new OleDbConnection _
("Provider=Micr osoft.Jet.OLEDB .4.0;" & _
"Data Source=c:\ASPNE T\data\banking. mdb")
'open connection
dim objCmd as OleDbDataAdapte r = new
OleDbDataAdapte r _
("select * from tblUsers", objConn)
'fill dataset
dim ds as DataSet = new DataSet()
objCmd.Fill(ds, "tblUsers")
'select data view and bind to server control
MyDataList.Data Source = ds.Tables("tblU sers"). _
DefaultView
MyDataList.Data Bind()
end sub
</script>
<html><body>
<ASP:DataList id="MyDataList " RepeatColumns=" 2"
RepeatDirection ="Vertical" runat="server">
<ItemTemplate >
<div style="padding: 15,15,15,15;fon t-size:10pt;
font-family:Verdana" >
<div style="font:12p t verdana;color:d arkred">
<i><b><%# DataBinder.Eval
(Container.Data Item, "FirstName")%>& nbsp;
<%# DataBinder.Eval
(Container.Data Item, "LastName") %>
</i></b>
</div>
<br>
<b>Address: </b><%# DataBinder.Eval
(Container.Data Item, _
"Address") %><br>
<b>City: </b><%# DataBinder.Eval
(Container.Data Item, _
"City")%><b r>
<b>State: </b><%# DataBinder.Eval _
(Container.Data Item, "State") %><br>
<b>ZIP: </b><%# DataBinder.Eval _
(Container.Data Item, "Zip") %><br>
<b>Phone: </b><%# DataBinder.Eval _
(Container.Data Item, "Phone") %><br>
</div>
</ItemTemplate>
</ASP:DataList>
</body></html>
*************** *************** **********
Here is the error message I received:
*************** *************** *************
No error information available: 0x800401F9.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.
Exception Details: System.Data.Ole Db.OleDbExcepti on: No
error information available: 0x800401F9.
Source Error:
Line 16: 'fill dataset
Line 17: dim ds as DataSet = new DataSet()
Line 18: objCmd.Fill(ds, "tblUsers")
Line 19:
Line 20: 'select data view and bind to server control
Source File: C:\Inetpub\wwwr oot\AspNet\21Da ys\day08
\listing0801.as px Line: 18
Stack Trace:
[OleDbException (0x800401f9): No error information
available: 0x800401F9.]
System.Data.Ole Db.OleDbConnect ion.ProcessResu lts(Int32
hr) +20
System.Data.Ole Db.OleDbConnect ion.CreateProvi derError
(Int32 hr) +23
System.Data.Ole Db.OleDbConnect ion.CreateProvi der
(OleDbConnectio nString constr) +107
System.Data.Ole Db.OleDbConnect ion.Open() +203
System.Data.Com mon.DbDataAdapt er.QuietOpen
(IDbConnection connection, ConnectionState & originalState)
+44
System.Data.Com mon.DbDataAdapt er.FillFromComm and(Object
data, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
+304
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet,
Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior) +77
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet,
String srcTable) +36
ASP.listing0801 _aspx.Page_Load (Object Sender, EventArgs
e) in C:\Inetpub\wwwr oot\AspNet\21Da ys\day08
\listing0801.as px:18
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +731
My code:
*************** *****
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace="Syst em.Data" %>
<%@ Import Namespace="Syst em.Data.OleDb" %>
<script language="VB" runat="server">
sub Page_Load(Sende r as Object, e as EventArgs)
'set up connection
dim objConn as new OleDbConnection _
("Provider=Micr osoft.Jet.OLEDB .4.0;" & _
"Data Source=c:\ASPNE T\data\banking. mdb")
'open connection
dim objCmd as OleDbDataAdapte r = new
OleDbDataAdapte r _
("select * from tblUsers", objConn)
'fill dataset
dim ds as DataSet = new DataSet()
objCmd.Fill(ds, "tblUsers")
'select data view and bind to server control
MyDataList.Data Source = ds.Tables("tblU sers"). _
DefaultView
MyDataList.Data Bind()
end sub
</script>
<html><body>
<ASP:DataList id="MyDataList " RepeatColumns=" 2"
RepeatDirection ="Vertical" runat="server">
<ItemTemplate >
<div style="padding: 15,15,15,15;fon t-size:10pt;
font-family:Verdana" >
<div style="font:12p t verdana;color:d arkred">
<i><b><%# DataBinder.Eval
(Container.Data Item, "FirstName")%>& nbsp;
<%# DataBinder.Eval
(Container.Data Item, "LastName") %>
</i></b>
</div>
<br>
<b>Address: </b><%# DataBinder.Eval
(Container.Data Item, _
"Address") %><br>
<b>City: </b><%# DataBinder.Eval
(Container.Data Item, _
"City")%><b r>
<b>State: </b><%# DataBinder.Eval _
(Container.Data Item, "State") %><br>
<b>ZIP: </b><%# DataBinder.Eval _
(Container.Data Item, "Zip") %><br>
<b>Phone: </b><%# DataBinder.Eval _
(Container.Data Item, "Phone") %><br>
</div>
</ItemTemplate>
</ASP:DataList>
</body></html>
*************** *************** **********
Here is the error message I received:
*************** *************** *************
No error information available: 0x800401F9.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.
Exception Details: System.Data.Ole Db.OleDbExcepti on: No
error information available: 0x800401F9.
Source Error:
Line 16: 'fill dataset
Line 17: dim ds as DataSet = new DataSet()
Line 18: objCmd.Fill(ds, "tblUsers")
Line 19:
Line 20: 'select data view and bind to server control
Source File: C:\Inetpub\wwwr oot\AspNet\21Da ys\day08
\listing0801.as px Line: 18
Stack Trace:
[OleDbException (0x800401f9): No error information
available: 0x800401F9.]
System.Data.Ole Db.OleDbConnect ion.ProcessResu lts(Int32
hr) +20
System.Data.Ole Db.OleDbConnect ion.CreateProvi derError
(Int32 hr) +23
System.Data.Ole Db.OleDbConnect ion.CreateProvi der
(OleDbConnectio nString constr) +107
System.Data.Ole Db.OleDbConnect ion.Open() +203
System.Data.Com mon.DbDataAdapt er.QuietOpen
(IDbConnection connection, ConnectionState & originalState)
+44
System.Data.Com mon.DbDataAdapt er.FillFromComm and(Object
data, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
+304
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet,
Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior) +77
System.Data.Com mon.DbDataAdapt er.Fill(DataSet dataSet,
String srcTable) +36
ASP.listing0801 _aspx.Page_Load (Object Sender, EventArgs
e) in C:\Inetpub\wwwr oot\AspNet\21Da ys\day08
\listing0801.as px:18
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +35
System.Web.UI.P age.ProcessRequ estMain() +731