The TableAdapter update command is not identical


A

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?
 
Ad

Advertisements

J

Jason M Penniman

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.
 
Ad

Advertisements

A

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" <jpenniman@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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top