Solved

Why some parameters are duplicated in the code of data source

Posted on 2012-03-18
2
411 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
ID: 37734754
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
ID: 37734863
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

911 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

16 Experts available now in Live!

Get 1:1 Help Now