Storing to database from datagrid

I want to store a table from data grid to a table in database. I defined a dataset. Is is possible to save the whole table or I have to save each row separately? How can I do it?

Thank you.

[204 byte] By [Vlash] at [2007-12-16]
# 1

I would use a DataAdapter to store a table to a database.

Your description isn't very specific, but generally what I would do is the following:

Create a connection to the database.
Create a DataAdapter using the connection.
Then either use VIsual Studio's built in SQL builder/DataAdapter Wizard or explicitly write the appropriate SQL.
Then you can call the DataAdapter's Update method passing it the appropriate dataTable or dataSet.

The individual steps can be much more complicated depending on what exactly you're trying to do.

If you provide more detail, I might be able to provide more guidance.

Good luck,
Nate

nathankoterba at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

Hi,

I have set a datagrid's datasource property to a DataTable, After making some changed i want to get updated this table to the database,

This datatable may on based of some condition e.g where clasuse ,

How will i update this datatable to the database

Himanshu Kansal

Noida

HimanshuKansal at 2007-9-9 > top of Msdn Tech,Windows Forms,Windows Forms General...