|
-
Mar 3rd, 2012, 11:58 AM
#13
Thread Starter
Fanatic Member
Re: ListView problem: no refreshing after item deletion
 Originally Posted by DataMiser
As for your other error it means that what you are searching for returned no results. You should always check and see if your query returned results before trying to read the fields of the query. Either you would use recordcount as I have here or test for EOF before accessing the fields.
Code:
sql2 = "SELECT * FROM baza_receptura WHERE nazvanje = " & Chr$(34) & string2klik & Chr$(34)
rs2.Open sql2, con, adOpenDynamic, adLockOptimistic
if rs2.recordcount>0 then
txtNazvanje.Visible = True
txtNaziv.Text = rs2.Fields(4).Value '>>>DEBUGGER SHOWS EOF ERROR HERE!<<<
txtNaziv.Visible = True
txtKomentar.Text = rs2.Fields(5).Value
txtKomentar.Visible = True
txtRezultat.Text = ""
Else
Msgbox "Record not found"
End If
this peace of code isn't a bad idea, generally. This way we can avoid database error. But... what to put instead of Msgbox? How to force the query to return something?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|