Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / June 2005



Tip: Looking for answers? Try searching our database.

Query works in Access but not in VB

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paulymon - 28 Jun 2005 15:15 GMT
The following query returns the all designs with the word Christmas in it
when executed in Access but returns no records when executed in VB 6.0

Select * from PI where DesignName Like '*Christmas*'

Could someone help point me in the right direction please.

I'm executing with the following code:

Set dbCN = New ADODB.Connection

strAd = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
       dbPath & ";Persist Security Info=False"

dbCN.ConnectionString = strAd
dbCN.Open
Set rsDetail = New ADODB.Recordset
strseq = "Select * from PI where DesignName Like '*Christmas*'"

rsDetail.Open strSeq, dbCN, adOpenKeyset, adLockOptimistic, adCmdStoredProc
Al Reid - 28 Jun 2005 15:26 GMT
> The following query returns the all designs with the word Christmas in it
> when executed in Access but returns no records when executed in VB 6.0
[quoted text clipped - 16 lines]
>
> rsDetail.Open strSeq, dbCN, adOpenKeyset, adLockOptimistic, adCmdStoredProc

When executing a query via ADO, it uses the ANSI SQL standard wild cards.  Thus, replace the '*' with '%'.

--
Al Reid
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.