Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2004, 10:08 PM
Registered User
 
Join Date: Feb 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default LIKE keyword in SQL statement

I'm using the QUERY Builder in VB.NET Data Adapter Configuration
Wizard. I can retrieve records from my ACCESS database with
all my SQL statements until I insert a LIKE keyword in the
SQL statement. Then I get no records from my database. Are SQL
statements using LIKE not allowed?

Thomas A. Barta
 
Old February 10th, 2004, 12:16 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yeah, LIKE is supported, but it usually doesn't return records when you don't use a wild card as well.

Consider this colum value:

'I am a text value in a column'

Also consider a SELECT with a LIKE:

SELECT Bla Bla WHERE MyColumn LIKE 'text value'

This SELECT doesn't return a record, because the column does not contain 'text value' exactly.
However, if you use a wild card, things will change:

SELECT Bla Bla WHERE MyColumn LIKE '%text value%'

Now, a record will be returned, because 'text value' is somewhere in the text column.
Use

SELECT Bla Bla WHERE MyColumn LIKE 'text value%'

to select columns that start with 'text value'

and

SELECT Bla Bla WHERE MyColumn LIKE '%text value'

to select columns that end with that text.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert a SQL Statement from MS Access to a SQL Corey Access 6 March 28th, 2007 12:33 PM
SQL Statement??? carswelljr SQL Server 2000 2 August 25th, 2006 12:40 PM
SQL Statement help johnman Access 1 October 22nd, 2004 10:20 AM
sql statement sand133 VB Databases Basics 2 September 29th, 2004 09:48 AM
Help with SQL statement acdsky SQL Language 3 June 18th, 2004 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.