i want to do are the ff:
Loop through the Rows in the Datatable using Foreach or For
Compare every row data with the textbox value.
Once the value is matched or exists then break the loop & view a message.
. and i want view message is a confirm box ("record exist. do you want to continue?)
. if the user click yes it will save and if no close the confirm box.
. i dont know how to show a confirm box.pls help me.
if did not matched or not exists then save as new record
& view a message(this message is an alert box only. and the showmessage is (successfully saved!.)
. i already have a code in alert box..here's my code:
getList() = inside code is stored procedure in sql server (list of all data)
DataTable orgTb = maDDL.getList();
if (orgTb.Select() != null) { foreach (DataRow row in orgTb.Rows ) { for (int i = 0; i < orgTb.Rows.Count; i++) { string bu = orgTb.Rows[i]["bu_code"].ToString(); string ar = orgTb.Rows[i]["area"].ToString(); string desc = orgTb.Rows[i]["item_descr"].ToString(); string dateIs = Convert.ToDateTime(orgTb.Rows[i]["date_issued"].ToString()).ToString(); if (bu.ToString() == txtCode.SelectedValue.ToString() && ar.ToString() == txtArea.SelectedValue.ToString() && desc.ToString() == txtDesc.Text.ToString()) { if (Convert.ToDateTime(dateIs.ToString()).ToString() == Convert.ToDateTime(DI.SelectedDate).ToString()) { //confirm box //"record exist. do you want to continue? //if(confirmbox=yes) //{ //save //} //else //{ //break; //} } } else { //alert box //successfully saved! } } }
pls.help me in this.
tnx in advance.