azae Posted January 19, 2005 Posted January 19, 2005 hi all, I already know how to do the search function.. But I need to do a perfect one. here is my code which is working SqlCeCommand cmd = conn.CreateCommand(); cmd.CommandText = querySQL; SqlCeDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { TXT_Description.Text = rdr.GetString(1); TXT_Something.Text = rdr.GetString(2); } cmd = null; rdr.Close(); so it will return TXT....Text whatever I want to know.. But how should I do if the data not found in the database? I want to place a message "Data Not Found" How to code? Quote
mocella Posted January 19, 2005 Posted January 19, 2005 I think if you initialize your string value(s) to your "Data Not Found" message prior to the loop you should be set. It's been a while since I used a datareader, but I think if you have any empty result-set the loop won't even run once, since it's top-checked. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.