Results 1 to 7 of 7

Thread: [RESOLVED] Search string syntax

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    243

    Resolved [RESOLVED] Search string syntax

    I have a TextBox for the user to input a search string. My button click code returns thr error 'No value given for one or more Parameters. I have tried various ways to write a SELECT string. Help appreciated.
    Code:
    Private Sub Button36_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button36.Click
            'Search
            Try
                'Clear the Datatable called dt
                dt.Clear()
                'SELECT conditions
                Dim SearchStr As String = "'%" & Me.TextBox18.Text & "%'"
    
                da = New OleDb.OleDbDataAdapter("SELECT * FROM [sheet1$] WHERE Surname LIKE SearchStr AND Member LIKE('%Ply.Member%') ORDER BY Surname", con)
    
    
                da.Fill(dt)
                'Bind the DataGrid to the Table
                DataGridView1.DataSource = dt
                
            Catch ex As Exception
                MsgBox(ex.Message)
            Finally
                con.Close()
            End Try
        End Sub
    Last edited by Kochanski; May 1st, 2009 at 10:47 AM. Reason: typing error

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