Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

How to retrieve each element from datagrid

  Asked By: Kiral    Date: May 23    Category: Asp.net    Views: 948
  

I have a datagrid and I need to access each element for other
purposes. For that I need to copy each column with 'n' elements of
datagrid into an array with 'n' size. How to do this.

My datagrid code is as follows.


Sub Page_Load(Src As Object, E As EventArgs)
Dim strConn as string ="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA
SOURCE=" & server.mappath("dbase3.mdb") & ";"
Dim strSQL as string ="select * from Factory1 order by Period"
Dim Conn as New OLEDBConnection(strConn)
Dim Cmd as New OLEDBCommand(strSQL,Conn)
Dim Rdr as OLEDBDataReader

Conn.Open()
Rdr=Cmd.ExecuteReader()
MyDataGrid.DataSource = Rdr
MyDataGrid.DataBind()
Rdr.close()
Conn.close()
End Sub

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Sairah Hashmi     Answered On: May 23

My advice is do this differently.

Make a DataTable and bind to that.

Then walking the datatable is easy.

www.learnasp.com/freebook/learn/datatable.aspx

 
Didn't find what you were looking for? Find more on How to retrieve each element from datagrid Or get search suggestion and latest updates.




Tagged: