Let me first explain my program :
I have a text box in which i will be entering name and then i have a button find details when i click on dis button that name which i will enter will be searched in the database and then if the name is found it will be displayed in the datagrid and will get a message "enquiry found" and if not then message will be popped that "enquiry does not exist" ...
Am getting only part of this correct....when i am searching a record i do get it in data grid with message "record found" however, when i search for another name , i get message " enquiry does not exists" even if the record is there and the same(record) gets display in the datagrid which is correct !!
what is the problm ? am just giving below part of the code , there is no prob with connection etc...so am just giving the code which might be problematic...plz correct me....secondly i want my data grid to be refreshed instead of each record appending the previous one in the data grid.....i hp to get a favourable reply....
here is my code :
If (dtenquiry.Rows.Count) > 0 And txtname.Text = dtenquiry.Rows(0).Item(1) Then
dgenqrec.DataSource = dtenquiry
cmdfound.Enabled = True
cmdnorecord.Enabled = False
dgenqrec.RefreshEdit()
ElseIf (dtenquiry.Rows.Count) > 0 And txtname.Text <> dtenquiry.Rows(0).Item(1) Then
MsgBox("Enquiry Details Not Found ")
cmdnorecord.Enabled = True
End If