i am using sqldatareader to retrieve data from database.
i want to check the if condition when i click the save button.
here an error !! after the first click it will do correctly another click cant do it. error is the reader is closed.
my code as shown.
Expand|Select|Wrap|Line Numbers
- save_click()
- dim dr as sqldatareader
- dr=cmd.exicutereader
- while dr.read
- if text1.text=dr.getvalue(1) and text2.text=dr.getvalue(2) then
- messagebox.show("exist")
- else
- cmd2.text=(insert into gogo values())
- endif
- end while
- dr.close()
- con.close()