473,399 Members | 2,858 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,399 software developers and data experts.

Is it better not to use DA's Update?

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?
Nov 18 '05 #1
1 1212
basically yes. see william's article below about why
http://tinyurl.com/378wu

--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/2bz4t
"Rod" <Ro*@NO.SPAM> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
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?

Nov 18 '05 #2

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

Similar topics

2
by: zarish | last post by:
hi, im using a disconnected recordset feature of ado.net in my webservice and pasing it to my application. public DataSet getAllCarTypes() { string sqlQuery = "select distinct(description)...
3
by: Paulb1us | last post by:
I want to update records from a csv file. I do this in a button click: //Create Adapters da = new OdbcDataAdapter("Select * FROM test.csv", conn); //Fill a data table da.Fill(dt);
1
by: Christopher Weaver | last post by:
When I invoke DA.Update(DataSetName, TableName) it invokes the DeleteCommand even though no rows have been deleted. This happens when a row has been altered. Anyone have an explanation for...
2
by: msnews.microsoft.com | last post by:
Hello, I have the scenario. I m building an application either in asp.net or window application. This application is base on n-tier application model. Let us take example of Northwind Database in...
7
by: Wayne Wengert | last post by:
I have a VB VSE 2005 project in which I need to rank about 35 columns of numbers. I want to end up with a dataset of ordinals. For example, if I have a dataset with 5 rows in which colA values are...
4
by: James | last post by:
Basically I have a DataGrid that I'm binding to the results of a stored procedure call. The recordset is fairly small. Initially I'm creating a DataSet from the results and binding it. There's a...
4
by: Stephen Plotnick | last post by:
In a data grid using Access as the data source.. The da.update is failing with "object reference not set to an instance of anobject" It looks like everything is ok and I was wondering if there...
8
by: Stephen Plotnick | last post by:
I have three forms and update one table in an Access DB with sucess in one form. In the other two forms I'm trying to do an update to a different table in the Access DB. The error I'm getting...
2
by: slinky | last post by:
I'm getting a error when I open my . aspx in my browser... line 34: da.Fill(ds, "Assets") Here's the error and my entire code for this .aspx.vb is below that ... I need some clues as to what is...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.