ASP.Net System.Data.OleDb.OleDbException

  • Hello there,

    Below is the code I have written for .aspx page. I am also posting the error i am getting for the same code. I am using MS Access as DB.

    ------------------------------------------------------

    Code

    ------------------------------------------------------

    SelectCommand="SELECT srno, userid, proname, descr, hrs, remarks FROM maindplog1 WHERE (srno = ?)" InsertCommand="INSERT INTO maindplog1(srno, userid,proname, descr, hrs, remarks) VALUES (?, ?, ?, ?, ?, ?)" UpdateCommand="UPDATE maindplog1 SET srno = ?, userid = ?, proname = ?, descr = ?, hrs = ?, remarks = ? WHERE (srno = ?)">

    arameter Name="srno" Type="String"/>

    arameter Name="userid" Type="String">

    arameter Name="proname" Type="String">

    arameter Name="descr" Type="String">

    arameter Name="hrs" Type="String">

    arameter Name="remarks" Type="String">

    ------------------------------------------------------

    Error

    ------------------------------------------------------

    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.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +267

    System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +192

    System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +48

    System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +106

    System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +108

    System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +401

    System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +721

    System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +78

    System.Web.UI.WebControls.DetailsView.HandleUpdate(String commandArg, Boolean causesValidation) +1152

    System.Web.UI.WebControls.DetailsView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +461

    System.Web.UI.WebControls.DetailsView.OnBubbleEvent(Object source, EventArgs e) +95

    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

    System.Web.UI.WebControls.DetailsViewRow.OnBubbleEvent(Object source, EventArgs e) +109

    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35

    System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +115

    System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +163

    System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7

    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11

    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +174

    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

    ------------------------------------------------------------

    thanks for your help..

    Neetal Shah

  • When you use the OleDB provider for .NET and parameterized queries, you'll need to use a little different syntax than you would use directly in Access:

    .SelectCommand="SELECT srno, userid, proname, descr, hrs, remarks FROM maindplog1 WHERE (srno = @srno)"

    Then, when adding parameters, use the same convention:

    <Parameter Name="@srno" Type="String"/>

    <ASP

    Hope this helps...

    Tim

    Tim Mitchell, Microsoft Data Platform MVP
    Data Warehouse and ETL Consultant
    TimMitchell.net | @Tim_Mitchell | Tyleris.com
    ETL Best Practices

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply