i have an error in this peace of code in my project in c# and access 2010
update_st_card is a textbox for card_id
ol_com.CommandText = "select [card_id] from student_info where [card_id] NOT IN ('"+update_st_card.Text+"')";
reader = ol_com.ExecuteReader();
//current_card_id = Convert.ToInt32(update_st_card.Text.ToString());
if ((string)reader["[card_id]"] == update_st_card.Text)
{
up_st_lbl2.Text = "error card_id is entered before";
}//end check for card id repeate or not if
else
{
//here i do update operation
}
Loading


Iftikar HussainRank #423 · 5.9K reputationPosted Jul 26, 2013, 3:20 AM EDT
What error you are getting?
Regards,
Iftikar
honar abubakr62 reputationPosted Jul 26, 2013, 5:32 AM EDT
http://s21.postimg.org/elotgvivb/Capture.png
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 26, 2013, 6:01 AM EDT
Regards,
Iftikar
honar abubakr62 reputationPosted Jul 26, 2013, 7:09 AM EDT
http://s13.postimg.org/e7wybusgn/Capture.png
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 26, 2013, 9:01 AM EDT
reader.close();
Regards,
Iftikar
Posted Jul 26, 2013, 9:35 AM EDT
If reader.HasRows== false then there're no records returned from the database.
If reader.HasRows== true means, the data reader contains atleast one record to read.