473,513 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net updatecommand problems: please help

first i apologize for the potential crosspost. this group gets far more
traffic. now that i have that out of the way... ;)

apparently using AutoGenerated Commands on Command objects does not work if
you use a stored procedure or commandtext that contains one or more inner
joins. im trying to implement a workaround that goes fine up to a particular
step.

I have a dataset that I bring to the client. This selectcommand statement
contains inner joins. i let the user make changes on the client then send
the dataset back for processing. this works fine.

behind the scenes, i query for a second, "comparison" dataset that *does
not* contain inner joins. this dataset contains the table's primary key,
along with 2 columns that I am going to update.the primary key for this
dataset matches the primary key for the first dataset.

i loop through the first dataset, and compare each column row by row. if the
keys match, then i change the field's value in the comparison dataset to the
value contained in the first dataset.

i then call adapter.update, and here is where it fails. I receive an error:
"column MyColumn is constrained to be unique. Value of 'MyValue' already
exists.".

It looks like the adapter is trying to also update the Primary Key field. I
am not sure why this is happening, since I do not change the primary key
value anywhere in code. I was under the impression that only those fields
that had changes would update.

Does this make sense? What step am I missing?

Nov 18 '05 #1
0 966

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2671
by: Andrew Dodgshun | last post by:
I have 2 grids - one shows a list of table names in a database and when you click on a table name the other grid dynamically populates the grid with the table contents. My problem is that I cannot...
0
987
by: Stephen Cairns | last post by:
I am very new to programming and in particular datagrids and am finding it difficult to add code to the event handler below to run an UpdateCommand on a row in my datagrid. Could someone please...
2
3471
by: Mark | last post by:
Hi, I have a datalist that I use to display and edit records to a user. Datalist shown below; visual basic code:-----------------------------------------------------------------------...
0
1799
by: Newasps | last post by:
Hi guys, I have a problem with UpdateCommand Event. In tihs event Ä°'m creating required controls to get that controls' values and also get them. But when I try to get updated values I'm getting the...
0
1523
by: Ozer | last post by:
Hi guys, I need some help. In my datagrid's updatecommand event i'm trying to get textboxes values and also do it. But when i update the values in textboxes and fire the event, I can't get the...
3
2655
by: Jim in Arizona | last post by:
I'm doing my best to learn ASPNET from a book devoted to ASPNET 1.0. So far, I haven't run into any problems, until now. This is a simple page that should just show the sql strings created by the...
5
4595
by: Peter W Johnson | last post by:
Hi Guys, I am having problems getting the following code to update an Access table. I get the following error:- An unhandled exception of type 'System.NullReferenceException' occurred in...
1
4255
by: Rich | last post by:
Hello, I can update a dataset from my client app using a dataAdapter.Updatecommand when I add parameter values outside of the param declaration. But If I add the param values inline with the...
6
13980
by: Rich | last post by:
Dim da As New SqlDataAdapter("Select * from tbl1", conn) dim tblx As New DataTable da.Fill(tblx) '--works OK up to this point da.UpdateCommand = New SqlCommand da.UpdateCommand.Connection =...
0
941
by: stuart_dent | last post by:
I have a SQL Server table with in Indetity column (value auto generated). I have tried to write my own updatecommand code. I can't get it to work. An error says that says Sku and rid are...
0
7267
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,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
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,...
0
7542
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...
0
5697
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,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1609
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 ...
0
466
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...

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.