Hi all,
Good Day! how to check select query using IF condition.
cmd = new SqlCommand("SELECT * FROM tValidation", cn); cmd.CommandType = CommandType.Text; rdr = cmd.ExecuteReader(); while (rdr.Read()) { foreach (Control ctrl in pTbPage.Controls) { if ((ctrl) is TextBox) { findFieldName = "fld" + ctrl.Name.Substring(3, (ctrl.Name.Length) - 3); cmd = new SqlCommand("SELECT * FROM tValidation where tTName='tAerator' and tFName=" + findFieldName + "", cn); { getType = rdr.GetString(rdr.GetOrdinal("tType")); } } }
cmd = new SqlCommand("SELECT * FROM tValidation", cn); cmd.CommandType = CommandType.Text; rdr = cmd.ExecuteReader(); while (rdr.Read()) { foreach (Control ctrl in pTbPage.Controls) { if ((ctrl) is TextBox) { findFieldName = "fld" + ctrl.Name.Substring(3, (ctrl.Name.Length) - 3); cmd = new SqlCommand("SELECT * FROM tValidation where tTName='tAerator' and tFName=" + findFieldName + "", cn); { getType = rdr.GetString(rdr.GetOrdinal("tType")); }
}
In this if findfieldname is equal to tFName (from remote database table) then i want get the tType of corresponding tFName from that table. How to check it. But it is always getting true.
Thanks & Regards Sasi ................. Go Green