Results 1 to 3 of 3

Thread: dataview

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    North east UK
    Posts
    129

    dataview

    Hi All,

    i am trying to write a simple search screen, 1 text box, 1 datagrid and a search button with a datafilter.

    VB Code:
    1. Dim sn As String
    2.         sn = txtSurname.Text
    3.         Dim dvCFilter As New DataView(objdsCSearch.Tables("CDetails"), _
    4.                                   "Surname = '& sn &'", _
    5.                                   "DOB", _
    6.                                   DataViewRowState.CurrentRows)
    7.             grdCDetails.DataSource = dvFilter

    This works if i change ' & sn & ' to an actual surname but i need to be able to search by the name entered into the text box.

    Should i be using dataview to filter?

    Cheers

  2. #2
    Lively Member
    Join Date
    Jan 2002
    Posts
    105
    Try:

    "Surname='" & sn &"'",

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2004
    Location
    North east UK
    Posts
    129
    DOH!!!!

    many thanks, worked a treat (must be out of practice).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width