Solved

Why some parameters are duplicated in the code of data source

Posted on 2012-03-18
2
417 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

726 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