I've been trying make a SQL LIKE statement for a search button to display data to, but it doesn't work . I've tried searching about it and even copy-pasted some of the working codes but still no.. I'm really new to this so please excuse my fail coding.
(vb.net 2008 + ms access 2003) here's my code :
item = txtsearch.Text
Dim con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim dr As OleDbDataReader
con.Open()
cmd = New OleDbCommand("SELECT * FROM moviedb WHERE Title Like = '%" & item & "%' ", con)
dr = cmd.ExecuteReader()
If (dr.Read() = True) Then
da = New OleDbDataAdapter("SELECT * FROM moviedb WHERE Title = '%" & item & "%' ", con)
da.Fill(ds, "List")
DataGridView1.DataSource = ds.Tables("List")
con.Close()
I've also tried changing the "%" to "*", but yeah still doesn't do it. It says Syntax error (missing operator) in query expression 'Title LIKE = '%@item%''.