473,474 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Cannot edit into MS Access database

4 New Member
I have experienced a problem here while doing a form for accessing datadbase using MS Access. I'm using the AccessDataSource control, and using Gridview to pull the data from the database. I am able to see the contents in the database, but whenever I click "Delete" or "Update", the data never gets deleted or get updated repectively. It feels as if it was a normal page load, nothing is done to the data in the database. I also have another problem is that when I insert new data, the error below is shown to me. I am using Visual Web Developer 2005 Express Edition. I have included my codings and the web.config file. How can I overcome this error? Please help me in this.

Thank you!


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

ERROR OCCURRED WHEN I INSERT NEW DATA

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.ExecuteCommandTextE rrorHandling(OleDbHResult hr) +65
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS dbParams, Object& executeResult) +181
System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult) +307
System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior, Object& executeResult) +77
System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior behavior, String method) +188
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +112
System.Web.UI.WebControls.SqlDataSourceView.Execut eDbCommand(DbCommand command, DataSourceOperation operation) +493
System.Web.UI.WebControls.SqlDataSourceView.Execut eInsert(IDictionary values) +549
System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback) +173
System.Web.UI.WebControls.DetailsView.HandleInsert (String commandArg, Boolean causesValidation) +627
System.Web.UI.WebControls.DetailsView.HandleEvent( EventArgs e, Boolean causesValidation, String validationGroup) +745
System.Web.UI.WebControls.DetailsView.OnBubbleEven t(Object source, EventArgs e) +162
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.DetailsViewRow.OnBubbleE vent(Object source, EventArgs e) +117
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e) +107
System.Web.UI.WebControls.LinkButton.RaisePostBack Event(String eventArgument) +175
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +244
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838

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

DEFAULT.ASPX PAGE CODING

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AccessDataSource ID="AccessDataSource1" runat="server" ConflictDetection="CompareAllValues"
DataFile="~/App_Data/db1.mdb" DeleteCommand="DELETE FROM [Table1] WHERE [Person ID] = ? AND [Name] = ? AND [Telphone Number] = ?"
InsertCommand="INSERT INTO [Table1] ([Person ID], [Name], [Telphone Number]) VALUES (?, ?, ?)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [Table1]"
UpdateCommand="UPDATE [Table1] SET [Name] = ?, [Telphone Number] = ? WHERE [Person ID] = ? AND [Name] = ? AND [Telphone Number] = ?">
<DeleteParameters>
<asp:Parameter Name="original_Person_ID" Type="Int32" />
<asp:Parameter Name="original_Name" Type="String" />
<asp:Parameter Name="original_Telphone_Number" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Telphone_Number" Type="Int32" />
<asp:Parameter Name="original_Person_ID" Type="Int32" />
<asp:Parameter Name="original_Name" Type="String" />
<asp:Parameter Name="original_Telphone_Number" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Person_ID" Type="Int32" />
<asp:Parameter Name="Name" Type="String" />
<asp:Parameter Name="Telphone_Number" Type="Int32" />
</InsertParameters>
</asp:AccessDataSource>

</div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="Person ID" DataSourceID="AccessDataSource1"
Style="z-index: 100; left: 10px; position: absolute; top: 59px">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowSelectButton="True" />
<asp:BoundField DataField="Person ID" HeaderText="Person ID" InsertVisible="False"
ReadOnly="True" SortExpression="Person ID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Telphone Number" HeaderText="Telphone Number" SortExpression="Telphone Number" />
</Columns>
</asp:GridView>
<asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
DataKeyNames="Person ID" DataSourceID="AccessDataSource1" Height="50px" Style="z-index: 102;
left: 16px; position: absolute; top: 355px" Width="125px">
<Fields>
<asp:BoundField DataField="Person ID" HeaderText="Person ID" InsertVisible="False"
ReadOnly="True" SortExpression="Person ID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Telphone Number" HeaderText="Telphone Number" SortExpression="Telphone Number" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
</form>
</body>
</html>

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

WEB.CONFIG FILE

<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.

Visual Basic options:
Set strict="true" to disallow all data type conversions
where data loss can occur.
Set explicit="true" to force declaration of all variables.
-->
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
Aug 14 '07 #1
0 1779

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: dixie | last post by:
I have some code that adds new records into a table for each ID in a list box when a button on a form is clicked. This works fine. My problem now is that I wish to be able to edit all the records...
8
by: L Mehl | last post by:
Hello -- Fairly often, but not always, when I start the app by clicking the mdb or an icon set up to start it, I get the message "Cannot find the file 'c:\path...\dbname.mdb' ...." and...
5
by: j.mandala | last post by:
Someone is trying to run my Access 2002 database under Access 2003. He has had a number of problems: 1) i used the MSComCt2.ocx for it's Date and Time picker. I can't find it under 2003. Do I...
2
by: HB2 | last post by:
I use to be able to highlight several records in a table, copy them and paste new records. Now when I right click the records the copy and paste functions are disabled. How do I enable them? ...
4
by: sea | last post by:
I have a database in Access 2002 but I am unable to view code or write any modules when logged in with a limited user account using Windows XP, service pack 2 -- no problems when logging in as...
12
by: dennist685 | last post by:
Can't edit, delete or add row in an Access database in a website 2003 When I implement a walkthrough using Northwind I have no trouble doing this. Also, in a windowsforms project I have no...
2
by: bbasberg | last post by:
I have been working hard to clean up my code but I am still wondering why all incoming records go to the "AddNew" part of the IF statement and never to the Edit alternative. I believe that it must be...
13
by: nicolegw | last post by:
I've tried googling for the answer to my question, so my apologies if it's been asked before or is terribly obvious. I'm a volunteer doing data entry for research. My office has an Access...
3
by: epearce301 | last post by:
Hi, I have table1 and table2, both are linked, and a query has been run. I created forms that use both just the tables, and then another one using just the query. All of the information is there,...
0
by: tedpottel | last post by:
Hi I am trying to right a script to keep a local copy of my mysql database in a local access file. I was able to do this in Access visual basic, but cannot get it to work in python. The...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.