Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, I am working with Visual Basic .net 2002; I am working with an Access 2002 Database.

 

I already have Datasets, connections.... I want to perform a search into a Table of the database and do something if it find matching records, and something different if it doesnt find anything.

 

Thanks in advance.

Posted

1.i'm using winforms.

 

2. No.

 

I just want to perform the search and use something like IF..THEN to do something if it returns results ... and something different (ELSE) if it doesnt return any result.

 

Thanks.

Posted

Look into using a datareader.

 

dim cmd as new OleDbCommand("sql code", connectionstring)
dim dr as oleDbDataReader
dr = cmd.ExecuteReader

if dr.HasRows = true then
        'do function for when there is rows
Else
        'do function for when there isnt rows
end if

Posted

Ok.... it works with:

 

Dim cmd As New OleDbCommand("sql code", connectionstring)

Dim dr As oleDbDataReader

dr = cmd.ExecuteReader

 

If dr.Read = True Then

'do function for when there is rows

Else

'do function for when there isnt rows

End If

 

 

Thanks !

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...