troubleshooting Question

How can I find inbeded strings in SQL an field using the 'LIKE' operator using VB6

Avatar of TopCatOnyx
TopCatOnyxFlag for United States of America asked on
Microsoft DevelopmentMicrosoft SQL Server 2008
6 Comments1 Solution318 ViewsLast Modified:
Hi Experts,
I'm trying to find records a substring within an SQL NVARCHAR field using VB6.  My select statement is:  
            sCont = "SELECT * FROM " & sTDSubProfile _
            & " WHERE Recording Like '%" & sOrg & "%'"
I'm trying to find all the records with sOrg in the 'Recording' field.  The field contains text before and after the sOrg value.  If I use the above select statement (replacing sOrg with the actual string) in the SQL Server Management Studio, I find numerous records.  However in VB6 no records are found.  I don't get any errors when using the above statement in the open command - just no records are found.  I suspect that '%' may not be the proper wildcard character to use.  Any ideas?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros