shaolinazul Posted January 29, 2004 Posted January 29, 2004 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. Quote
Moderators Robby Posted January 29, 2004 Moderators Posted January 29, 2004 Are your using WinForms or WebForms? Are you going to show the results to the user, if so then in what type of control? Quote Visit...Bassic Software
shaolinazul Posted January 30, 2004 Author Posted January 30, 2004 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. Quote
Eleventeen Posted January 30, 2004 Posted January 30, 2004 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 Quote
shaolinazul Posted January 31, 2004 Author Posted January 31, 2004 I get this error with eleventeen's code: 'HasRows' is not a member of 'System.Data.OleDb.OleDbDataReader' Quote
shaolinazul Posted January 31, 2004 Author Posted January 31, 2004 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 ! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.