Error when inserting a record using FormView.

Discussion in 'ASP.NET 2.0' started by ruizbennett, Mar 7, 2006.

  1. Does the table supossed to have a primary key that auto increments? Perhaps that isn't set up properly.

    Or perhaps are you trying to do a function inside of the database that ends up adding null to a column?

    A good test... If any of your columns can be nullable, specify it. Then see which column is null after you add.
     
  2. I'm getting error 0x80004005 when I try to insert a new record. All other database functions work fine, Update, delete etc. I'm runing a simple script created using MS Visual Web Developer 2005 on to an Access databse with two records. As soon as I insert a new record using the insert link on the "form view" tools box item. Any help is appreciated.



    aka "you tried to assign the null value to a variable that is not a variant data type"
     
  3. Bruce

    Bruce DiscountASP.NET Staff

  4. Here is the complete error. Thanks in advance.


    Server Error in '/' Application.
    You tried to assign the Null value to a variable that is not a Variant data type.
    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: You tried to assign the Null value to a variable that is not a Variant data type.

    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 (0x80004005): You tried to assign the Null value to a variable that is not a Variant data type.]
    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.ExecuteInsert(IDictionary values) +447
    System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +72
    System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation) +388
    System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +623
    System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e) +95
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
    System.Web.UI.WebControls.FormViewRow.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


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
     

Share This Page