Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Using LIKE in SQL


Using LIKE in SQL

Author
Message
Kane_W2
K
Junior Member
Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Posts: 1, Visits: 1
Hi,

I have got a SQL statement that fetched data from the table 'authors' and places the data in a datgrid on the form.

This works fine,

Dim default As String "SELECT * FROM authors WHERE authorname = 'Ken Davies' "

The problem occurs when I introduce the LIKE command into the sql statement like this,

"SELECT * FROM authors where authorname LIKE 'Ken Davies' "

All I keep getting is an empty datagrid...

any suggestion much appreciated.

Edited
9/9/2017 by Admin
Admin
Admin
Administrator
Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)Administrator (703 reputation)

Group: Administrators
Posts: 81, Visits: 1.2K
You need to use wildcards such as % for SQL Server, and * for Access.

where authorname LIKE '%Ken Davies%'



Best regards,

Forum Administrator
A1VBCode



GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search