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

Posted Jul 26, 2013, 1:35 PM
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.
Iftikar HussainPosted Jul 26, 2013, 1:01 PM
reader.close();
Regards,
Iftikar
honar abubakrPosted Jul 26, 2013, 11:09 AM
http://s13.postimg.org/e7wybusgn/Capture.png
Iftikar HussainPosted Jul 26, 2013, 10:01 AM
Regards,
Iftikar
honar abubakrPosted Jul 26, 2013, 9:32 AM
http://s21.postimg.org/elotgvivb/Capture.png
Iftikar HussainPosted Jul 26, 2013, 7:20 AM
What error you are getting?
Regards,
Iftikar