469,945 Members | 1,831 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,945 developers. It's quick & easy.

ASPX database connection problem

********************
My code:
********************
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>

<script language="VB" runat="server">
sub Page_Load(Sender as Object, e as EventArgs)
'set up connection
dim objConn as new OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\ASPNET\data\banking.mdb")

'open connection
dim objCmd as OleDbDataAdapter = new
OleDbDataAdapter _
("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.DataSource = ds.Tables("tblUsers"). _
DefaultView
MyDataList.DataBind()
end sub
</script>

<html><body>
<ASP:DataList id="MyDataList" RepeatColumns="2"
RepeatDirection="Vertical" runat="server">
<ItemTemplate>
<div style="padding:15,15,15,15;font-size:10pt;
font-family:Verdana">
<div style="font:12pt verdana;color:darkred">
<i><b><%# DataBinder.Eval
(Container.DataItem, "FirstName")%>&nbsp;
<%# DataBinder.Eval
(Container.DataItem, "LastName")%>
</i></b>
</div>
<br>
<b>Address: </b><%# DataBinder.Eval
(Container.DataItem, _
"Address") %><br>
<b>City: </b><%# DataBinder.Eval
(Container.DataItem, _
"City")%><br>
<b>State: </b><%# DataBinder.Eval _
(Container.DataItem, "State") %><br>
<b>ZIP: </b><%# DataBinder.Eval _
(Container.DataItem, "Zip") %><br>
<b>Phone: </b><%# DataBinder.Eval _
(Container.DataItem, "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.OleDb.OleDbException: 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\wwwroot\AspNet\21Days\day08
\listing0801.aspx Line: 18

Stack Trace:
[OleDbException (0x800401f9): No error information
available: 0x800401F9.]
System.Data.OleDb.OleDbConnection.ProcessResults(I nt32
hr) +20
System.Data.OleDb.OleDbConnection.CreateProviderEr ror
(Int32 hr) +23
System.Data.OleDb.OleDbConnection.CreateProvider
(OleDbConnectionString constr) +107
System.Data.OleDb.OleDbConnection.Open() +203
System.Data.Common.DbDataAdapter.QuietOpen
(IDbConnection connection, ConnectionState& originalState)
+44
System.Data.Common.DbDataAdapter.FillFromCommand(O bject
data, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
+304
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet,
Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior) +77
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet,
String srcTable) +36
ASP.listing0801_aspx.Page_Load(Object Sender, EventArgs
e) in C:\Inetpub\wwwroot\AspNet\21Days\day08
\listing0801.aspx:18
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

Nov 17 '05 #1
0 927

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Vladimír Kolesnik | last post: by
4 posts views Thread by Nathaniel Sherman | last post: by
reply views Thread by Eustice Scrubb | last post: by
reply views Thread by malcolm | last post: by
3 posts views Thread by fniles | last post: by
3 posts views Thread by LamSoft | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.