Home All Groups Group Topic Archive Search About

The TableAdapter update command is not identical

Author
4 Apr 2006 9:09 PM
ad
I am using vs2005 to desginer a tableadapter.

I have modify the update command in the desginer, but the update command is
not identical between the desginer.

For example:

The original update command is:

Update Employee set EmployeeID=@EmployeeID and EmployeeName=@EmployeeName
where EmployeeID=@Original_EmployeeID and
EmployeeName=@Original_EmployeeName

I change it in the designer to

Update Employee set EmployeeName=@EmployeeName where
EmployeeID=@Orginal_EmployeeID, and the count of parameter is 2.

But the commandtext in deginser.cs still remain the orginal become:

Update Employee set EmployeeName=@EmployeeName where
EmployeeID=@Orginal_EmployeeID ;
Select EmployeeID, EmployeeName form Employee where EmployeeID=@EmployeeID;

It also add a @EmployeeID parameter.

Why it add a select command below the update statement?

Author
4 Apr 2006 11:26 PM
Jason M Penniman
Author
5 Apr 2006 1:33 AM
ad
Thank, I thought this select command is generated when I check "Refersh the data table" in DataTableAdapter wizard.
If I did not check, the Select command will not be generate after the update command.

But can I modify the "Refersh the data table" attribute after DataTableadapter wizard?


  "Jason M Penniman" <jpenni***@gmail.com> 撰寫於郵件新聞:1144193216.12280.9.camel@asclepius...
  The select statement is added to "refresh" the data in your dataset.  This ensures the data in the dataset matches the database.  It's best practice when persisting data.

  On Wed, 2006-04-05 at 05:09 +0800, ad wrote:
I am using vs2005 to desginer a tableadapter.

I have modify the update command in the desginer, but the update command is
not identical between the desginer.

For example:

The original update command is:

Update Employee set EmployeeID=@EmployeeID and EmployeeName=@EmployeeName
where EmployeeID=@Original_EmployeeID and
EmployeeName=@Original_EmployeeName

I change it in the designer to

Update Employee set EmployeeName=@EmployeeName where
EmployeeID=@Orginal_EmployeeID, and the count of parameter is 2.

But the commandtext in deginser.cs still remain the orginal become:

Update Employee set EmployeeName=@EmployeeName where
EmployeeID=@Orginal_EmployeeID ;
Select EmployeeID, EmployeeName form Employee where EmployeeID=@EmployeeID;

It also add a @EmployeeID parameter.

Why it add a select command below the update statement?

AddThis Social Bookmark Button