By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 671 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

What to use for displaying the results of a Search in vb?

P: 60
Exactly i have to perform a search in a database.

After that i have to display that result to the user BUT
the problem is that the number of RECORDS return by the search will vary according to the input given by the user?

i think that explains my problem !!!

what can be the probable solution?

TIA

with best regards
vishwas
Sep 19 '07 #1
Share this Question
Share on Google+
3 Replies


hariharanmca
100+
P: 1,977
Till you are not clear.

Do you mean search up to last character of search string?

Let me assume that.
Then the query will be

Expand|Select|Wrap|Line Numbers
  1. Dim strSql As String
  2. StrSql = “Select * from tblName where SearchDbField like ‘” & strSearchString & ”%’”
Sep 19 '07 #2

P: 60
Till you are not clear.

Do you mean search up to last character of search string?

Let me assume that.
Then the query will be

Expand|Select|Wrap|Line Numbers
  1. Dim strSql As String
  2. StrSql = “Select * from tblName where SearchDbField like ‘” & strSearchString & ”%’”

i am asking about the displaying the records that are present in the RECORDSOURCE after the search is complete
Sep 19 '07 #3

P: 88
i am asking about the displaying the records that are present in the RECORDSOURCE after the search is complete
i assume you have stored all your records in a recordset - i will call it rstData. you can then use the following code to access the data and write it out:

Expand|Select|Wrap|Line Numbers
  1. do while not rstData.eof
  2.    strString = rstData(0) ' assigns the value of the current row's first column to strString
  3.     intInteger = rstData("CustomerNr") ' assigns the value of the field in the column named "CustomerNr" of the current row to intInteger
  4. loop
make sure you use the correct data types.
Sep 19 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.