473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Is there a setting to regenerate the UpdateCommand of tableadapter

I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *. It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only the
changed columns are being updated and the where condition is using the
primary key or some specific columns?

Is it realistic to use tableadaper without extending its functionalities in
real application?
Aug 8 '07 #1
7 2962
Peter,

Keep in mind that the Where clause looks like that because that is how
concurrency is being handled.

Kerry Moorman

"Peter" wrote:
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *. It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only the
changed columns are being updated and the where condition is using the
primary key or some specific columns?

Is it realistic to use tableadaper without extending its functionalities in
real application?
Aug 8 '07 #2
Hi Kerry,

Thanks. Is there a way to set concurrency to check only columns changed?
It seems that the tableadapter only offers optimistic concurrency or
pessimistic concurrency.
Peter

"Kerry Moorman" wrote:
Peter,

Keep in mind that the Where clause looks like that because that is how
concurrency is being handled.

Kerry Moorman

"Peter" wrote:
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *. It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only the
changed columns are being updated and the where condition is using the
primary key or some specific columns?

Is it realistic to use tableadaper without extending its functionalities in
real application?
Aug 8 '07 #3
Peter,

I wonder if you can use a commandbuilder with a tableadapter.

I think the commandbuilder builds the kind of dynamic sql you are talking
about. A commandbuilder is usually associated with a dataadapter, which a
tableadapter tries to hide.

Kerry Moorman
"Peter" wrote:
Hi Kerry,

Thanks. Is there a way to set concurrency to check only columns changed?
It seems that the tableadapter only offers optimistic concurrency or
pessimistic concurrency.
Peter

"Kerry Moorman" wrote:
Peter,

Keep in mind that the Where clause looks like that because that is how
concurrency is being handled.

Kerry Moorman

"Peter" wrote:
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *. It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only the
changed columns are being updated and the where condition is using the
primary key or some specific columns?
>
Is it realistic to use tableadaper without extending its functionalities in
real application?
Aug 8 '07 #4

"Peter" <Pe***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *.
It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only
the
changed columns are being updated and the where condition is using the
primary key or some specific columns?

Is it realistic to use tableadaper without extending its functionalities
in
real application?
Remember that what the wizard is doing is finding the "best way" to find a
row to update it. If you don't have primary keys then its best guess is to
compare all the fields original values to the database. Otherwise the
wizard has no idea of what you intend. If you don't have primary key but
know how to get the original row from the data using several of the fields
then manually change the update SQL.

Hope this helps
Lloyd Sheen

Aug 8 '07 #5
Lloyd,

No, the wizard knows the primary key.

The wizard is using all the columns in the Where clause to handle
concurrency issues, not to find the correct row to update.

Kerry Moorman
"Lloyd Sheen" wrote:
>
"Peter" <Pe***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *.
It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only
the
changed columns are being updated and the where condition is using the
primary key or some specific columns?

Is it realistic to use tableadaper without extending its functionalities
in
real application?

Remember that what the wizard is doing is finding the "best way" to find a
row to update it. If you don't have primary keys then its best guess is to
compare all the fields original values to the database. Otherwise the
wizard has no idea of what you intend. If you don't have primary key but
know how to get the original row from the data using several of the fields
then manually change the update SQL.

Hope this helps
Lloyd Sheen

Aug 8 '07 #6
Hi Kerry,

I want to implement the Optimistic Concurrency on Update Strategy #3 - Check
Only Changed Fields or Optimistic Concurrency on Update Strategy #4 -
Implement Timestamp stated in this article
http://davidhayden.com/blog/dave/arc...0/05/2503.aspx

Does .net have any prebuilt functionality I can use or I need to hardcode
these type of concurrency solution? I think both solutions are very common.
Peter
"Kerry Moorman" wrote:
Lloyd,

No, the wizard knows the primary key.

The wizard is using all the columns in the Where clause to handle
concurrency issues, not to find the correct row to update.

Kerry Moorman
"Lloyd Sheen" wrote:

"Peter" <Pe***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *.
It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only
the
changed columns are being updated and the where condition is using the
primary key or some specific columns?
>
Is it realistic to use tableadaper without extending its functionalities
in
real application?
Remember that what the wizard is doing is finding the "best way" to find a
row to update it. If you don't have primary keys then its best guess is to
compare all the fields original values to the database. Otherwise the
wizard has no idea of what you intend. If you don't have primary key but
know how to get the original row from the data using several of the fields
then manually change the update SQL.

Hope this helps
Lloyd Sheen
Aug 9 '07 #7
Peter,

Whenever possible I use option #4, a timestamp column. I think it allows for
the cleanest and most readable code.

I never use tableadapters and only rarely use updatable datasets. Instead, I
map a database row to a business object using the active record pattern.

So I control my data access code and use ado.net command objects to insert,
update and delete rows. This makes it very straightforward to use timestamps
to deal with concurrency issues.

All the Visual Studio wizards end up using tableadapters or
dataadapters/datasets. I don't have much experience with the available
concurrency options in those scenarios.

That being said, it seems to me that there is an option to use a timestamp
column for handling concurrency in the 2005 versions of the Visual Studio
wizards. You might want to look into that if you are going in that direction.

Kerry Moorman
"Peter" wrote:
Hi Kerry,

I want to implement the Optimistic Concurrency on Update Strategy #3 - Check
Only Changed Fields or Optimistic Concurrency on Update Strategy #4 -
Implement Timestamp stated in this article
http://davidhayden.com/blog/dave/arc...0/05/2503.aspx

Does .net have any prebuilt functionality I can use or I need to hardcode
these type of concurrency solution? I think both solutions are very common.
Peter
"Kerry Moorman" wrote:
Lloyd,

No, the wizard knows the primary key.

The wizard is using all the columns in the Where clause to handle
concurrency issues, not to find the correct row to update.

Kerry Moorman
"Lloyd Sheen" wrote:
>
"Peter" <Pe***@discussions.microsoft.comwrote in message
news:64**********************************@microsof t.com...
I'm not sure whether I'm missing something or not. I reviewed the SQL
Statements generated by tableadapter when the selectcommand is select *.
It
seems they are extremely bad. The updatecommand is updating every columns
and the where condition is also every column. Is there a setting or
something to regenerate the update statement during runtime so that only
the
changed columns are being updated and the where condition is using the
primary key or some specific columns?

Is it realistic to use tableadaper without extending its functionalities
in
real application?
>
Remember that what the wizard is doing is finding the "best way" to find a
row to update it. If you don't have primary keys then its best guess is to
compare all the fields original values to the database. Otherwise the
wizard has no idea of what you intend. If you don't have primary key but
know how to get the original row from the data using several of the fields
then manually change the update SQL.
>
Hope this helps
Lloyd Sheen
>
>
Aug 9 '07 #8

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

Similar topics

5
by: Programatix | last post by:
Hi, Have anyone ever benchmark the TableAdapter performance compared to DataTable's Load method? I found out that the DataTable's Load method is about 10x faster than TableAdapter's Fill method....
9
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
3
by: Mike | last post by:
Dear Group, When I add a DataTable to a Typed Dataset, and a TableAdapter to the DataTable, I am able to create methods to send updates directly to the database (GenerateDBDirectMethods),...
15
by: philip | last post by:
On a form, I have a datagridview. This datagridview is constructed on a dataset filled by a tableadapter. The table adapter do very well what it must do when filling dataset. Insertions,...
2
by: susan.f.barrett | last post by:
Hi, Despite me being able to type the following in to SQL Server and it updating 1 row: > updatestockcategory 1093, 839 In my code, it is not updating any rows. dataSet = new DataSet();
1
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
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 =...
3
by: =?Utf-8?B?UmljaCBIdXRjaGlucw==?= | last post by:
I'm not really sure how to ask this question because I'm still getting my feet wet with data access and VB.NET, but here goes: To start off with, I'm using VB 2005 Express to connect to an Access...
0
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.