Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 October 7th, 2005, 04:12 AM
Authorized User
 
Join Date: Oct 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to fix the error : Exception Details: System.D

hi there, the problem is....when i display all records of products table, it shows all the record. however , when i try to display some of them , it show the error , i dont know how ti fix, anyone helps me ? thanx

<%@ Page Language="VB" %>
<%@ import Namespace="System.Data " %>
<%@ import Namespace="System.Data.OleDb " %>
<script runat="server">

    ' Insert page code here
              '


              Sub Page_Load(Sender As Object, E As EventArgs)

                  Dim connectionString As String
                  Dim queryString As string
                  Dim data As new DataSet()
                  Dim dbConnection As OleDbConnection
                  Dim dataAdapter As OleDbDataAdapter

                  ''''''
                  connectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=D:\assign2\db1.mdb"
                  queryString = "SELECT [products].[prod_image], [products].[prod_name], [products].[prod_desc], [products].[pro_price] FROM [product_categories] LEFT JOIN [products] ON [product_categories].[prod_id]=[products].[prod_id] WHERE [product_categories].[cat_id] = 12345"
                  'open the connection

                  dbConnection = new OleDbConnection(connectionString)
                  dataAdapter = new OleDbDataAdapter(queryString, dbConnection)

                  'fill the dataset with data
                  dataAdapter.Fill(data,"products")

                  'bind the date grid to the data
                  DataGrid.DataSource = data.Tables("products")
                  DataGrid.DataBind()




              ENd sub

</script>
<html>
<head>
</head>
<body>
    <form runat="server">

        <asp:DataGrid id="DataGrid" runat="server" HeaderStyle-BackColor="#aaaadd" Font-Size="8pt" Font-Name="Verdana" CellPadding="3" BorderColor="Black" BackColor="#CCCCFF" Width="800px" Font-Names="Verdana">
            <HeaderStyle backcolor="#AAAADD"></HeaderStyle>
            <Columns>
                <asp:TemplateColumn SortExpression="khai" HeaderText="Add to Cart" FooterText="khai">
                    <ItemTemplate>
                        <asp:Button runat="server" Text="Add To Cart" CommandName="Select" CausesValidation="false" id="btnAdd" ></asp:Button>
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>
    </form>
</body>
</html>



this is an error :

No value given for one or more required parameters.
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 value given for one or more required parameters.

Source Error:

Line 25:
Line 26: 'fill the dataset with data
Line 27: dataAdapter.Fill(data,"products")
Line 28:
Line 29: 'bind the date grid to the data


Source File: D:\assign2\laptop.aspx Line: 27

Stack Trace:

[OleDbException (0x80040e10): No value given for one or more required parameters.]
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr) +41
   System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +122
   System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +92
   System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +65
   System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +112
   System.Data.OleDb.OleDbCommand.ExecuteReader(Comma ndBehavior behavior) +69
   System.Data.OleDb.OleDbCommand.System.Data.IDbComm and.ExecuteReader(CommandBehavior behavior) +5
   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.laptop_aspx.Page_Load(Object Sender, EventArgs E) in D:\assign2\laptop.aspx:27
   System.Web.UI.Control.OnLoad(EventArgs e) +55
   System.Web.UI.Control.LoadRecursive() +27
   System.Web.UI.Page.ProcessRequestMain() +731




 
Old October 7th, 2005, 12:45 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Try using a Try ... Catch block. You might get a more detailed erromessage :
Response.Write(ex.message)

Also put your code in an If NOT IsPostBack Then statment. You don't want this code to execute everytime the page is posted back.

Jim

 
Old October 9th, 2005, 12:24 AM
Authorized User
 
Join Date: Oct 2005
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default


thax for your help :*







Similar Threads
Thread Thread Starter Forum Replies Last Post
System out of memory exception cmrhema Visual Studio 2005 0 August 21st, 2007 08:38 AM
Exception Details: System.Net.WebException: The re charnata ASP.NET 2.0 Professional 2 January 5th, 2007 11:05 AM
System.OutOfMemory Exception Ron Howerton ASP.NET 1.0 and 1.1 Professional 7 November 30th, 2005 10:08 AM
Chapter 10 system exception error dkelly BOOK: Beginning VB.NET Databases 1 July 28th, 2005 04:07 AM
System.Exception .aspx website dephjam C# 3 April 13th, 2005 07:59 PM





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