How to search a Record in DataTable C#
Contoh coding
DataRow[] foundRows = dtvstations.Select("stationname = 'KL' ");
conn = foundRows[0]["connstring"].ToString();
Apply method
private void CB_vstation_SelectedIndexChanged(object sender, EventArgs e)
{
if(CB_vstation.Text.ToString() != "")
{
string exp = "stationname = '" + CB_vstation.Text.ToString() + "'";
MessageBox.Show(exp);
DataRow[] foundRows = dtvstations.Select(exp);
conn = foundRows[0]["connstring"].ToString();
viewByStation(conn);
}
}
Rujukan :
Ulasan