how to get datatable column value in c#
  • how can i get cell value from datatable in c#.
  • 2 Comments sorted by
  • you cannot find all colum value datatable or datset works on compelte rows if you find only colum value you need to find it with index no .

    For j = 0 To dtTaskDetail.Rows.Count - 1
    DropDown_Department.Items.Add(New ListItem(dtTaskDetail.Rows(j)(1).ToString, dtTaskDetail.Rows(j)(0).ToString))

    next    . it will fill all data of colum  

    for further details and related topics http://www.codecorner.somee.com/
  • Vote Up0Vote Down ithackerithacker
    117.50 Karma Accepted Answer
    you can use this code.

    string ColumnValue=DatatableName.Rows[0].Cells[0].Value.ToString();

    or on loop like

    foreach(DataRow dr in dt.Rows)
    {
    string ColumnValue=dr["ColumnName"].ToString();
    }


Howdy, Stranger!

It looks like you're new here. If you want to get involved, or you want to Ask a new Question, Please Login or Create a new Account by Clicking below

Login with Facebook

Tagged

Popular Posts of the Week

Optimum Creative