473,771 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ 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 AccessDataSourc e 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.Ole Db.OleDbExcepti on: 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.Ole Db.OleDbCommand .ExecuteCommand TextErrorHandli ng(OleDbHResult hr) +65
System.Data.Ole Db.OleDbCommand .ExecuteCommand TextForSingleRe sult(tagDBPARAM S dbParams, Object& executeResult) +181
System.Data.Ole Db.OleDbCommand .ExecuteCommand Text(Object& executeResult) +307
System.Data.Ole Db.OleDbCommand .ExecuteCommand (CommandBehavio r behavior, Object& executeResult) +77
System.Data.Ole Db.OleDbCommand .ExecuteReaderI nternal(Command Behavior behavior, String method) +188
System.Data.Ole Db.OleDbCommand .ExecuteNonQuer y() +112
System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteDbCommand (DbCommand command, DataSourceOpera tion operation) +493
System.Web.UI.W ebControls.SqlD ataSourceView.E xecuteInsert(ID ictionary values) +549
System.Web.UI.D ataSourceView.I nsert(IDictiona ry values, DataSourceViewO perationCallbac k callback) +173
System.Web.UI.W ebControls.Deta ilsView.HandleI nsert(String commandArg, Boolean causesValidatio n) +627
System.Web.UI.W ebControls.Deta ilsView.HandleE vent(EventArgs e, Boolean causesValidatio n, String validationGroup ) +745
System.Web.UI.W ebControls.Deta ilsView.OnBubbl eEvent(Object source, EventArgs e) +162
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +56
System.Web.UI.W ebControls.Deta ilsViewRow.OnBu bbleEvent(Objec t source, EventArgs e) +117
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +56
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e) +107
System.Web.UI.W ebControls.Link Button.RaisePos tBackEvent(Stri ng eventArgument) +175
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument) +31
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +32
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +244
System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +3838

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

DEFAULT.ASPX PAGE CODING

<%@ Page Language="VB" AutoEventWireup ="false" CodeFile="Defau lt.aspx.vb" Inherits="_Defa ult" %>

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

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AccessData Source ID="AccessDataS ource1" runat="server" ConflictDetecti on="CompareAllV alues"
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 (?, ?, ?)"
OldValuesParame terFormatString ="original_{ 0}" SelectCommand=" SELECT * FROM [Table1]"
UpdateCommand=" UPDATE [Table1] SET [Name] = ?, [Telphone Number] = ? WHERE [Person ID] = ? AND [Name] = ? AND [Telphone Number] = ?">
<DeleteParamete rs>
<asp:Paramete r Name="original_ Person_ID" Type="Int32" />
<asp:Paramete r Name="original_ Name" Type="String" />
<asp:Paramete r Name="original_ Telphone_Number " Type="Int32" />
</DeleteParameter s>
<UpdateParamete rs>
<asp:Paramete r Name="Name" Type="String" />
<asp:Paramete r Name="Telphone_ Number" Type="Int32" />
<asp:Paramete r Name="original_ Person_ID" Type="Int32" />
<asp:Paramete r Name="original_ Name" Type="String" />
<asp:Paramete r Name="original_ Telphone_Number " Type="Int32" />
</UpdateParameter s>
<InsertParamete rs>
<asp:Paramete r Name="Person_ID " Type="Int32" />
<asp:Paramete r Name="Name" Type="String" />
<asp:Paramete r Name="Telphone_ Number" Type="Int32" />
</InsertParameter s>
</asp:AccessDataS ource>

</div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="Tr ue" AllowSorting="T rue"
AutoGenerateCol umns="False" DataKeyNames="P erson ID" DataSourceID="A ccessDataSource 1"
Style="z-index: 100; left: 10px; position: absolute; top: 59px">
<Columns>
<asp:CommandFie ld ShowDeleteButto n="True" ShowEditButton= "True" ShowSelectButto n="True" />
<asp:BoundFie ld DataField="Pers on ID" HeaderText="Per son ID" InsertVisible=" False"
ReadOnly="True" SortExpression= "Person ID" />
<asp:BoundFie ld DataField="Name " HeaderText="Nam e" SortExpression= "Name" />
<asp:BoundFie ld DataField="Telp hone Number" HeaderText="Tel phone Number" SortExpression= "Telphone Number" />
</Columns>
</asp:GridView>
<asp:DetailsVie w ID="DetailsView 1" runat="server" AllowPaging="Tr ue" AutoGenerateRow s="False"
DataKeyNames="P erson ID" DataSourceID="A ccessDataSource 1" Height="50px" Style="z-index: 102;
left: 16px; position: absolute; top: 355px" Width="125px">
<Fields>
<asp:BoundFie ld DataField="Pers on ID" HeaderText="Per son ID" InsertVisible=" False"
ReadOnly="True" SortExpression= "Person ID" />
<asp:BoundFie ld DataField="Name " HeaderText="Nam e" SortExpression= "Name" />
<asp:BoundFie ld DataField="Telp hone Number" HeaderText="Tel phone Number" SortExpression= "Telphone Number" />
<asp:CommandFie ld ShowDeleteButto n="True" ShowEditButton= "True" ShowInsertButto n="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\Micros oft.Net\Framewo rk\v2.x\Config
-->
<configuratio n>
<appSettings/>
<connectionStri ngs/>
<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="Syst em"/>
<add namespace="Syst em.Collections"/>
<add namespace="Syst em.Collections. Specialized"/>
<add namespace="Syst em.Configuratio n"/>
<add namespace="Syst em.Text"/>
<add namespace="Syst em.Text.Regular Expressions"/>
<add namespace="Syst em.Web"/>
<add namespace="Syst em.Web.Caching"/>
<add namespace="Syst em.Web.SessionS tate"/>
<add namespace="Syst em.Web.Security "/>
<add namespace="Syst em.Web.Profile"/>
<add namespace="Syst em.Web.UI"/>
<add namespace="Syst em.Web.UI.WebCo ntrols"/>
<add namespace="Syst em.Web.UI.WebCo ntrols.WebParts "/>
<add namespace="Syst em.Web.UI.HtmlC ontrols"/>
</namespaces>
</pages>
<!--
The <authentication > section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authenticati on 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="RemoteOnl y" defaultRedirect ="GenericErrorP age.htm">
<error statusCode="403 " redirect="NoAcc ess.htm" />
<error statusCode="404 " redirect="FileN otFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
Aug 14 '07 #1
0 1799

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

Similar topics

25
10422
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 for people whose ID is in the list box. I made minor changes to the code (mainly replacing rs.AddNew with rs.Edit)and it appears to be updating only the first record and then overwriting that record with the next, etc until it runs out of ID's...
8
4929
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 then the app starts, as if there were no problem. The mdb is located correctly. I assume that all required libraries are
5
7865
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 need to send it to them? 2) I have a function to fill a table with values, that store the page and column numbers of a display of staff members. I had him check the link to Microsoft DAO 3.6 Object Library under references, but it still won't...
2
1846
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? Thanks
4
1855
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 administrator, -- any ideas on how a limited user on Windows XP can access code and modules in Access 2002? Thank you very much.
12
2042
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 problem editing, adding or deleting rows. But in webforms the smarttags don't offer the options. Can anybody help?
2
2335
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 because my rs.index never really receives the value from the cell in the spreadsheet that it should use to compare to the corresponding field in the Access DB. I have named the field "rtitle" in Access and made it an index called riskIndex. I am an...
13
2262
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 database with several hundred fields that was put together by someone who no longer works here. While using this database, I've noticed that it's missing a number of fields that we need. I told the Dr. I'm working for and encouraged her to seek the...
3
3954
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, but I cannot edit any records nor can I move to a new record on the forms. I checked to see if they were locked, and they are not. Please help!
0
1034
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 procedure works by storing the last index value after each update. Then I do a quarry for all records with a index value bigger the the last one stored.
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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 we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.