Solved

Why some parameters are duplicated in the code of data source

Posted on 2012-03-18
2
408 Views
Last Modified: 2012-03-18
Hi:

We're creating some web application using VS 2010 with Visual Basic.

We try to insert a new record into an ACCESS table, or update/delete an existing record using DetailsView associated with AccessDataSource

We configure DetailsView to bind with the AccessDataSource and also configure the AccessDataSource for SELECT, INSERT, UPDATE, and DELETE statements.

In DetailsView we check "Enable Inserting", "Enable Editing", "Enable Deleting"

We currently have a problem with editing, deleting, and inserting. We're trying to figure out what causes the problem. We looked into the auto-generated code of AccessDataSource. We found that some parameters are duplicated:

In <DeleteParameters> and <UpdateParameters>, the parameters "Amount" and "Tax" are duplicated. (I've bolded them in the below source code).

Would you help to look into these and let us know if this is some kind of error or why they're duplicated.

Thanks a lot for any help,

Somits

//---------------------------

<asp:AccessDataSource ID="AccessDataSource1" runat="server"
DataFile="~/App_Data/Database3.accdb"
               SelectCommand="SELECT * FROM [vb_access_db3_tb2]"
ConflictDetection="CompareAllValues"
               DeleteCommand="DELETE FROM [vb_access_db3_tb2] WHERE
(([Order ID] = ?) OR ([Order ID] IS NULL AND ? IS NULL)) AND
(([Amount] = ?) OR ([Amount] IS NULL AND ? IS NULL)) AND (([Tax] = ?)
OR ([Tax] IS NULL AND ? IS NULL))"
               InsertCommand="INSERT INTO [vb_access_db3_tb2] ([Order
ID], [Amount], [Tax]) VALUES (?, ?, ?)"
               OldValuesParameterFormatString="original_{0}"
               UpdateCommand="UPDATE [vb_access_db3_tb2] SET [Amount]
= ?, [Tax] = ? WHERE (([Order ID] = ?) OR ([Order ID] IS NULL AND ? IS
NULL)) AND (([Amount] = ?) OR ([Amount] IS NULL AND ? IS NULL)) AND
(([Tax] = ?) OR ([Tax] IS NULL AND ? IS NULL))">
               <DeleteParameters>
                   <asp:Parameter Name="original_Order_ID" Type="String" />
                   <asp:Parameter Name="original_Amount" Type="Double" />
                   <asp:Parameter Name="original_Amount" Type="Double" />
                   <asp:Parameter Name="original_Tax" Type="Double" />
                   <asp:Parameter Name="original_Tax" Type="Double" />

               </DeleteParameters>
               <InsertParameters>
                   <asp:Parameter Name="Order_ID" Type="String" />
                   <asp:Parameter Name="Amount" Type="Double" />
                   <asp:Parameter Name="Tax" Type="Double" />
               </InsertParameters>
               <UpdateParameters>
                   <asp:Parameter Name="Amount" Type="Double" />
                   <asp:Parameter Name="Tax" Type="Double" />
                  <asp:Parameter Name="original_Order_ID" Type="String" />
                   <asp:Parameter Name="original_Amount" Type="Double" />
                   <asp:Parameter Name="original_Amount" Type="Double" />
                   <asp:Parameter Name="original_Tax" Type="Double" />

                   <asp:Parameter Name="original_Tax" Type="Double" />
               </UpdateParameters>
           </asp:AccessDataSource>

//---------------------------
0
Comment
Question by:somits
2 Comments
 
LVL 6

Accepted Solution

by:
Triskelion earned 500 total points
Comment Utility
This looks like a bug in th auto generator.
If you delete the duplicate lines, is everything OK?

Was the wizard run more than once?
Was there any manual manipulation of the code or the schema between runs of the wizard?
0
 

Author Comment

by:somits
Comment Utility
Hi Triskelion:

You're right. I run the wizardc more than once.

I deleted the data source and reconfigure it. The duplication is gone.
However, I still could not update the record or delete it or insert the new one.

I still miss something that cause this error. If you've some idea about this, please help me in another question.

Thanks a lot.

Somits
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ASP.NET e-commerce website 4 26
System32Int Error 8 44
MS Access 2010 Form Building 3 22
Search field on a form 7 13
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now