Getting the data from datatable in asp.net -


I am using

datatable and putting outlook contacts I in your web application. This is my code

  DataTable myTable = New DataTable (); Datarov Dr. = myTable.NewRow (); Data columns myDataColumn = new DataColumn (); MyDataColumn.DataType = Type.GetType ("System.String"); MyDataColumn.ColumnName = "email"; MyTable.Columns.Add (myDataColumn); Microsoft.Office.Interop.Outlook.Application oApp = New Microsoft.Office.Interop.Outlook.Application (); foreach (Microsoft.Office.Interop.Outlook.AddressList addList in oApp.Session.AddressLists) {foreach (addList.AddressEntries Microsoft.Office.Interop.Outlook.AddressEntry addEntry) {Dr. [ "email"] = addEntry.Address.ToString (); MyTable.Rows.Add (Dr.); Dr = myTable.NewRow (); //Response.Write (addEntry.Address.ToString ()); }}  

My relation is I can write code like this when the contact is inserted into the table. Description of the line like this

string S = [0] ["email"] toString () myTable.Rows can read in a string; In the foreach

You can use the DataHow collection of foreach loop and obtain the corresponding row values . Specify the column name or column index of

  foreach (DataRow dr in myTable.Rows) {// datacolumn // dr ["ColumnName"]. ToString (); }  

Or you can use DataTable's DataView and iterate through the DataRowView archive

  DataView dv = myTable.DefaultView; Foreach (DataRowView drv in DV) {drv.Row ["columnName"] ToString () .; }  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -