473,786 Members | 2,574 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2978
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***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.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***@discussi ons.microsoft.c omwrote in message
news:64******** *************** ***********@mic rosoft.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
7559
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. I used the same SELECT query and DataSet (predefined), for both test. For the DataTable's Load method, we first need to create a DataReader.
9
2917
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 answered... There are articles on the new TableAdapters where it says that a key new advantage is that a single TableAdapter, which can have multiple queries, can be used on multiple forms. Now that was in an article on using TableAdapters with...
3
7221
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), however when my TableAdapter Fill SQL contains a WHERE clause which looks up a field from another joined table, the Fill works perfectly, but I cannot Insert, Update or Delete using the TableAdapter. Does anyone know why this is?
15
2562
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, modifications and deletions functions very well in the dataset. But impossible to transmit modifications in ACCESS database. Impossible to WRITE in database. Here is the code for data transmission from tableadapter to Access database :
2
13969
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
4272
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 param delcaration, then I have to invoke the update operation twice - by leaving the updated row - returning to the row and re-invoking the update procedure. Is there something else I need to do to add param values inline with the param...
6
14002
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 = conn da.UpdateCommand.CommandText = "Update tbl1 set fld1 = 'test' where ID = 1" da.Update(tblx) '--tblx/tbl1 not getting updated here.
3
18928
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 database. I have a dataset in which a parameterized query returns the correct result set in the forms of a tableadapter and a bindingnavigator. In other words, I can perform my query and see that the tableadapter and bindingnavigator contain...
0
947
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 invalid column names. I don't know why. I even modified the Updatecommand the a bare bones
0
9650
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9497
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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 we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.