Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 11th, 2004, 05:09 PM
Registered User
 
Join Date: Feb 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to frogfur
Default Chapte2 DataControl.aspx

This is a problem in Chapter 2 of ASP.NET with VB.NET

This is the Code, I have added debug after it says to when I get the error message.

<% @Import Namespace="System.Data" %>
<% @Import Namespace="System.Data.OleDb" %>
<%@ Page Language="vb" Debug="true" %>

<script language="vb" runat = "server">

Sub Page_Load(Sender as Object, E as EventArgs)

    Dim objConnection As OleDbConnection
    Dim objCommand As OleDbDataAdapter
    Dim strConnect As String
    Dim StrCommand As String
    Dim DataSet1 As New DataSet

    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;"
    strConnect += "Data Source=C:\Program Files\Microsoft.NET\FrameworkSDK\"
    strConnect += "Samples\quickstart\aspplus\samples\grocertogo\dat a"
    strConnect += "\grocertogo.mdb;"
    strConnect += "Persist Security Info=False"

    strCommand = "SELECT ProductName, UnitPrice FROM products"
    objConnection = New OleDbConnection(strConnect)
    objCommand = New OleDbDataAdapter(strCommand, objConnection)
    objCommand.Fill(DataSet1,"products")
    DataGrid1.DataSource=DataSet1.Tables("Products").D efaultView
    DataGrid1.DataBind()
End Sub

</script>
<html>
<head>
<title>Data Grid Control example</title>
</head>
<body>
<asp:DataGrid id="DataGrid1" runat="server" />
</body>
</html>


Now I get the Error Message:
Server Error in '/BegASPNET' Application.
--------------------------------------------------------------------------------

'C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\quickstar t\aspplus\samples\grocertogo\data\grocertogo.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
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: 'C:\Program Files\Microsoft.NET\FrameworkSDK\Samples\quickstar t\aspplus\samples\grocertogo\data\grocertogo.mdb' is not a valid path. Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

Source Error:


Line 22: objConnection = New OleDbConnection(strConnect)
Line 23: objCommand = New OleDbDataAdapter(strCommand, objConnection)
Line 24: objCommand.Fill(DataSet1,"products")
Line 25: DataGrid1.DataSource=DataSet1.Tables("Products").D efaultView
Line 26: DataGrid1.DataBind()


Source File: C:\BegASPNET\Ch02\groceries.aspx Line: 24


I get the same error when I run the one from the download that I got from wrox books.

Has anyone else had this same problem?

Do I need to change the connection path?
If so, How did you fix it?






Similar Threads
Thread Thread Starter Forum Replies Last Post
DBCombo and DataControl Clive Astley VB Databases Basics 0 April 6th, 2006 10:31 AM
datacontrol.aspx example problem wendyhod ASP.NET 1.0 and 1.1 Basics 0 May 4th, 2005 09:48 AM
Chapter 2 datacontrol.aspx frogfur BOOK: Beginning ASP.NET 1.0 1 March 19th, 2005 12:59 PM
Problem with CH02 datacontrol.aspx Nikon BOOK: Beginning ASP.NET 1.0 1 October 25th, 2004 02:13 AM
Problem running datacontrol.aspx in Chapter 2 andersond BOOK: Beginning ASP.NET 1.0 5 October 29th, 2003 07:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.