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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishwaskothari
    New Member
    • Aug 2007
    • 60

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

    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
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    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

    [CODE=vb]Dim strSql As String
    StrSql = “Select * from tblName where SearchDbField like ‘” & strSearchString & ”%’”[/CODE]

    Comment

    • vishwaskothari
      New Member
      • Aug 2007
      • 60

      #3
      Originally posted by hariharanmca
      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

      [CODE=vb]Dim strSql As String
      StrSql = “Select * from tblName where SearchDbField like ‘” & strSearchString & ”%’”[/CODE]

      i am asking about the displaying the records that are present in the RECORDSOURCE after the search is complete

      Comment

      • BlackMustard
        New Member
        • Aug 2007
        • 88

        #4
        Originally posted by vishwaskothari
        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:

        [code=vb]do while not rstData.eof
        strString = rstData(0) ' assigns the value of the current row's first column to strString
        intInteger = rstData("Custom erNr") ' assigns the value of the field in the column named "CustomerNr " of the current row to intInteger
        loop[/code]

        make sure you use the correct data types.

        Comment

        Working...