Try This

Sujit Patil replied to touseef ahmed at 12-May-08 12:26

Use DataAdapter to fill data from db to dataset and then just bind that ds to your gridview like;

Dim ds As New DataSet

Dim cn As New SqlClient.SqlConnection(ConnectionString)

Dim adpt As New SqlClient.SqlDataAdapter("select * from urtbl",cn)

adpt.Fill(ds)

grdView.Datasource=ds

grdView.DataBind()

For more details go thr these links;

http://msdn.microsoft.com/en-us/library/bh8kx08z(VS.71).aspx

http://www.beansoftware.com/ASP.NET-Tutorials/DataSet-DataAdapter.aspx

To do vice-versa means to get all data of gridview into a ds you have to create a table and have to access a gridview row by row and then you can crate insert that row into table. like;

Dim cnt

For cnt = 0 To grvMsg.Rows.Count - 1

Str = grvMsg.Rows(cnt).Cells(0) ///////////this wil gives u text of 0 th cell of each row create a new row n just padd to one table. Same u can access other row data also

Next

Best Luck!!!!!!!!!!

Sujit.

 


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  datagrid or dataview send the data to dataset or datatable.. - touseef ahmed  12-May-08 03:55 3:55:39 AM
      Use the DataTable as the DataSource. - Peter Bromberg  11-May-08 05:05 5:05:30 PM
      Bind Datagrid - sundar k  11-May-08 10:50 10:50:59 PM
      DataGrid sending data - Sanjay Verma  11-May-08 11:53 11:53:50 PM
      Check here - santhosh kapa  12-May-08 12:05 12:05:35 AM
      Try This - Sujit Patil  12-May-08 12:26 12:26:53 AM
      Check this - Chirag Bhavsar  12-May-08 12:57 12:57:58 AM
      Have a look at this - chakradhar koturu  12-May-08 01:09 1:09:29 AM
View Posts