c# - How to use the Columns of dataset -
i have result set of dataset
below
[![dataset][1]][1]
now want add if
condition checking below
if(dataset rows(usermail) == 10000){then go ahead}
this code.
dataset ds = new dataset(); using (sqlconnection conn = new sqlconnection(configurationsettings.appsettings["connectionstring"].tostring())) { sqlcommand sqlcomm = new sqlcommand("get_inward_reminder_report", conn); sqlcomm.commandtype = commandtype.storedprocedure; sqldataadapter da = new sqldataadapter(); da.selectcommand = sqlcomm; da.fill(ds); if(dataset rowchecking) { } }
so issue, how check , compare dataset columns.
you can below:
int first = convert.toint32(ds.tables[0].rows[0]["columnname1"].tostring()); string second = ds.tables[0].rows[0]["columnname2"].tostring();
so case can like:
foreach (datarow dr in ds.tables[0].rows) { if(dr["useremail"].tostring() == "10000") { //do something; } }
Comments
Post a Comment