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? 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?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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)...
|
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);
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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,...
| |