Results 1 to 2 of 2

Thread: Filtering Records

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Pilipinas
    Posts
    441

    Filtering Records

    I am using this code to select the record I want but I encounter an error.

    Dim drsql As New OleDb("SELECT * FROM employee WHERE empno like '" TextBox1.Text "'", OleDbConnection1)
    'Dim DataSet11 As New DataSet()
    DataSet11.Clear()
    drsql.Fill(DataSet11, "Employee")
    DataGrid1.DataSource = DataSet11

    Kindly correct this for me?

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Your select statment is wrong.
    If empno is a text field then it shoud be;
    "SELECT * FROM employee WHERE empno like '" & TextBox1.Text & "%'"
    And if empno is a numeric field you can not use 'Like' to filter the records.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

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