Expand|Select|Wrap|Line Numbers
- SqlConnection cn = new SqlConnection();
- cn.ConnectionString = "Data Source= ;Database= ;uid= ;pwd= ";
- cn.Open();
- string sqt = "Select status from tracking where no=@o";
- SqlCommand cmr = new SqlCommand(sqt, cn);
- cmr.Parameters.AddWithValue("@o", Convert.ToInt32(textBox1.Text));
- status = Convert.ToString(cmr.ExecuteScalar());
- if (status == "abcd")
- MessageBox.Show("Record updated");
- else
- MessageBox.Show("Record not updated");
- cn.Close();
I want that when status is abcd then it should show the mess. record updated else the other one mess.
But when i m debugging it,even if i m giving the no for which status is abcd,it is showing the else mess.
The main problem is that if condition always evaluates to false even if status in database is abcd.
plzzzz reply soon.thanks for support.