Is it better not to use DA's Update?

R

Rod

I am writing my third ASP.NET application. Unfortunately for me, I get to
work on these only once every few months (which doesn't help in trying to
remember how to do everything).

Anyway, I've got some textboxes on an ASPX page and a submit button. I have
a data adapter on the ASPX page, along with the generated DataSet. I allowed
the DataAdapter to generate the Select, Update, Delete SQL strings (it is
running against a SQL Server 2000 database), and then modified the
associated SQL to better fine-tune them; especially the Insert and Update
statements.

However, I have discovered that when I attempt to save data (either
inserting or updating), from the textboxes (which are data bound to one of
the data tables in the data set), that the data does not get saved to the
tables. I simply don't understand why not. I have verified that the data in
the textboxes are present, even when saving the data, and I have done the
best I can to make sure the data isn't wiped out during the postback, but it
still isn't getting saved.

So, I've been looking at example code and seeing how others do it. One thing
I have noticed is that none of the example code using the data adapter's
Update method in order to save data to the database. Instead all of them
construct a SqlCommand object, assign the appropriate Insert or Update
statement and make up SqlParameters, and then save them.

This leads me to ask the general question, in ASP.NET applications is it
best to NEVER use the data adapter's Update method to insert/update/delete
data from a database?
 

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