Im creating an application where some data should be populated in a gridview and then user should be able to update it and then same should be replicate to the database. So i have put a gridview and configure it to connect to my database which is base on access 2007. On grid view configuration i have enable the option INSERT, UPDATE and DELET statement based on my select statement. I have also put my access file in the "App_Data" folder in the application. When run the application the gridview work perfectly fine, it display all the information which is avialble in the access file, but problem arise when user update the gridview. The following is the problem:

**Server Error in '/' Application.

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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[OleDbException (0x80040e10): No value given for one or more required parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr) +1081708
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +247
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +58
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +167
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +113
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +394
System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +697
System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +95
System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1226
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +855
System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +95
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +121
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +169
System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +9
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +176
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563**

The following is the sorce code.

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Register3 (a).aspx.vb" Inherits="WebApplication1.WebForm5" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            text-align: center;
            font-size: small;
            font-family: Arial, Helvetica, sans-serif;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p class="style1">
        <strong style="font-size: x-large">REGISTER BIDS (A)</strong></p>
    <p class="style1">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" DataKeyNames="Quotation_no" 
            DataSourceID="AccessDataSource1">
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="Quotation_no" HeaderText="Quotation_no" 
                    ReadOnly="True" SortExpression="Quotation_no" />
                <asp:BoundField DataField="Procurement_title" HeaderText="Procurement_title" 
                    SortExpression="Procurement_title" />
                <asp:BoundField DataField="Estimated_cost" HeaderText="Estimated_cost" 
                    SortExpression="Estimated_cost" />
                <asp:BoundField DataField="Earmarking_effected" 
                    HeaderText="Earmarking_effected" SortExpression="Earmarking_effected" />
                <asp:BoundField DataField="Approve_committee_needs" 
                    HeaderText="Approve_committee_needs" SortExpression="Approve_committee_needs" />
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            ConflictDetection="CompareAllValues" DataFile="~/App_Data/Tender.accdb" 
            DeleteCommand="DELETE FROM [bids_tbl] WHERE (([Quotation_no] = ?) OR ([Quotation_no] IS NULL AND ? IS NULL)) AND (([Procurement_title] = ?) OR ([Procurement_title] IS NULL AND ? IS NULL)) AND (([Estimated_cost] = ?) OR ([Estimated_cost] IS NULL AND ? IS NULL)) AND (([Earmarking_effected] = ?) OR ([Earmarking_effected] IS NULL AND ? IS NULL)) AND (([Approve_committee_needs] = ?) OR ([Approve_committee_needs] IS NULL AND ? IS NULL))" 
            InsertCommand="INSERT INTO [bids_tbl] ([Quotation_no], [Procurement_title], [Estimated_cost], [Earmarking_effected], [Approve_committee_needs]) VALUES (?, ?, ?, ?, ?)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT [Quotation_no], [Procurement_title], [Estimated_cost], [Earmarking_effected], [Approve_committee_needs] FROM [bids_tbl]" 
            UpdateCommand="UPDATE [bids_tbl] SET [Procurement_title] = ?, [Estimated_cost] = ?, [Earmarking_effected] = ?, [Approve_committee_needs] = ? WHERE (([Quotation_no] = ?) OR ([Quotation_no] IS NULL AND ? IS NULL)) AND (([Procurement_title] = ?) OR ([Procurement_title] IS NULL AND ? IS NULL)) AND (([Estimated_cost] = ?) OR ([Estimated_cost] IS NULL AND ? IS NULL)) AND (([Earmarking_effected] = ?) OR ([Earmarking_effected] IS NULL AND ? IS NULL)) AND (([Approve_committee_needs] = ?) OR ([Approve_committee_needs] IS NULL AND ? IS NULL))">
            <DeleteParameters>
                <asp:Parameter Name="original_Quotation_no" Type="String" />
                <asp:Parameter Name="original_Procurement_title" Type="String" />
                <asp:Parameter Name="original_Procurement_title" Type="String" />
                <asp:Parameter Name="original_Estimated_cost" Type="String" />
                <asp:Parameter Name="original_Estimated_cost" Type="String" />
                <asp:Parameter Name="original_Earmarking_effected" Type="String" />
                <asp:Parameter Name="original_Earmarking_effected" Type="String" />
                <asp:Parameter Name="original_Approve_committee_needs" Type="String" />
                <asp:Parameter Name="original_Approve_committee_needs" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="Quotation_no" Type="String" />
                <asp:Parameter Name="Procurement_title" Type="String" />
                <asp:Parameter Name="Estimated_cost" Type="String" />
                <asp:Parameter Name="Earmarking_effected" Type="String" />
                <asp:Parameter Name="Approve_committee_needs" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="Procurement_title" Type="String" />
                <asp:Parameter Name="Estimated_cost" Type="String" />
                <asp:Parameter Name="Earmarking_effected" Type="String" />
                <asp:Parameter Name="Approve_committee_needs" Type="String" />
                <asp:Parameter Name="original_Quotation_no" Type="String" />
                <asp:Parameter Name="original_Procurement_title" Type="String" />
                <asp:Parameter Name="original_Procurement_title" Type="String" />
                <asp:Parameter Name="original_Estimated_cost" Type="String" />
                <asp:Parameter Name="original_Estimated_cost" Type="String" />
                <asp:Parameter Name="original_Earmarking_effected" Type="String" />
                <asp:Parameter Name="original_Earmarking_effected" Type="String" />
                <asp:Parameter Name="original_Approve_committee_needs" Type="String" />
                <asp:Parameter Name="original_Approve_committee_needs" Type="String" />
            </UpdateParameters>
        </asp:AccessDataSource>
    </p>
</asp:Content>

Please help me in finding the problem which cause this error.

Your issue is that one of the fields in your table requires a value.

[OleDbException (0x80040e10): No value given for one or more required parameters.]

Seems like you are trying to pass a null value.

OK.. im looking about the problem in the database, in a field i have put the data type as 'yes/no' and under field properties iv put default value '0'. Im learning more about the default value, what does it mean exactly....thank for your reply JorgeM

Default value for a database field means that if you do not provide a value in the insert process, that value will be used.

What are the extra/doubled parameter fields?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.