TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Durga Velusamy
NA
318
113.8k
how to compare 2 values are equal or not
Jul 7 2015 5:38 AM
the below code shows message as deleted successfully after delete data from database its fine. but
also it shows same message even the data not in the table.
now i need compare empno from database and my value of empno i.e passing from frontend textbox are equal.
if equl means then only permit to delete query to delete.
else
means it need to show message as
Data Not in Table
[WebMethod(EnableSession = true)]
public List<Emptab> Delete(string[] datas)
{
List<Emptab> tDataList = new List<Emptab>();
Emptab tdata;
try
{
tdata = new Emptab();
tdata.empno = datas[0];
tdata.gender = datas[1];
tdata.eaddress = datas[2];
tdata.street = datas[3];
tdata.city = datas[4];
tdata.state = datas[5];
tdata.pin = datas[6];
tdata.mobile = datas[7];
tdata.mail = datas[8];
tdata.cnumber = datas[9];
tdata.ename = datas[10];
tdata.dob = datas[11];
tdata.age = datas[12];
tdata.qualification = datas[13];
tdata.depart = datas[14];
tdata.design = datas[15];
string ls_query = "";
ls_query = "delete from emptab where empno ='" + datas[0] + "'";
odcon = new OdbcConnection(con);
odcon.Open();
if (tdata.empno == datas[0])
{
comm = new OdbcCommand(ls_query, odcon);
comm.ExecuteNonQuery();
tdata.dsexecstatus = "Success";
tdata.dsmsg = "Deleted Successfully";
tDataList.Add(tdata);
}
else
{
tdata = new Emptab();
tdata.dsexecstatus = "FAIL";
tdata.dsmsg = "CANNOT ABLE TO DELETE ";
tDataList.Add(tdata);
}
}
catch (Exception)
{
throw;
}
odcon.Close();
return tDataList;
}
Reply
Answers (
4
)
How To Updated the marquee text in asp.net
How Integrate Hardware with c# Web application