Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Why some parameters are duplicated in the code of data source

Posted on 2012-03-18
2
Medium Priority
?
426 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 2000 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

916 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