How to do Complete search function

azae

Member
Joined
Jan 6, 2005
Messages
18
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
[VB]
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();
[/VB]
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?
 
I think if you initialize your string value(s) to your "Data Not Found" message prior to the loop you should be set.

Its been a while since I used a datareader, but I think if you have any empty result-set the loop wont even run once, since its top-checked.
 
Back
Top