Chat with sexy nudes without singing up com Updating datasource using dataadapter

There must be some way of automatically synchronizing the dataset with the current gridview values.

Hi Data binding theory for gridview says that you can edit only one item (row ) at a time, and you can set that using Edit Item Index, when you add an Edit button in row with command name = Edit then it will make the row in edit mode automatically and its updated, In your case you are updating the stuff manually by using javascript, so you have to rethink about the stuff, in every update if you ajaxically postback and update your dataset and finally in final update you can update your database using adapter, you can do that by using row editing, row updating etc events of the grid view to do this.

updating datasource using dataadapter-42

But if the blue lines in the above code are commented, then the INSERT SQL command doesn't add a new row in the data source. I know that data can be inserted WITHOUT using Sql Data Adapter (& that's what I have shown in the code in my first post) but IF Sql Data Adapter is used (as shown in the code in my follow-up), is it necessary to update the Data Set/Data Table first & then update the data source? Tables("My Table")) When I run the above script, a new row gets added to the data source, correct? Sql Client; private void Insert Data() protected void Button1_Click(object sender, Event Args e) Vinz, I don't think you have understood my question yet.N between them you must do an update of the Main Table before you do it of the liked one. but supose an application with 40 or 50 typed dataset with datasets with 5 6 or 8 Data Tables.... I write here a code I have used to generate the Commands in version 1.1 and version 2.0.You'll see there is a big difference cause the in dot Net 2.0 the Commande Builder class really works and creates the Parametes with the names of the columns Tables.The duplicated code that should be removed is when you define the parameter.

The parameter value does not need to be specified here.

Right now, on submitting the gridview, I can see that the value of the changed field is properly posted back: Hi! But I really wanted to use the dataset directly, so that I can pass it to a dataadapter for updating the database table.

If I manually extract the values, then I would have to re-build the dataset.

Tables("My Table") sql Cmd = New Sql Command("INSERT INTO My Table (Col1, Col2) VALUES (@Val1, @Val2)", sql Conn) With sql Cmd . It might also mean a high risk for a Data Integrity bug like in this example where the data is set directly.

So if you would try to omit that line the changes doesn't reflect in your datasource as what you have noticed..

This is the reason why I am asking whether it is mandatory to update the Data Table first before updating the data source? As what i have observed in your code you are just Updating the values from your Database and not in the Data Table so thats why its mandatory to have that line you have commented out..