VB6, Crystal Reports 6 or 7, SqlQuery

Consecutive Blanks deleted from String in SqlQuery

Page 1 of 1

0 Replies - 1464 Views - Last Post: 29 July 2008 - 03:25 PM Rate Topic: -----

#1 gklocek  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 29-July 08

VB6, Crystal Reports 6 or 7, SqlQuery

Post icon  Posted 29 July 2008 - 03:25 PM

I am having problems with an older application designed in VB6 that uses Crystal Reports V6 and V7. When I pass a SQL Query command to Crystal Reports OCX v6 or v7 like this (where 'b' is a Blank Space) ...

 ...
 objCrystalReport.SqlQuery = "SELECT * FROM tblPartMaster WHERE PartNum = '1b2bb3bbb4bbbb'"
 ...
 


What actually makes it to Crystal Reports is this ...

  SELECT * FROM tblPartMaster WHERE PartNum = '1b2b3b4b'
 



The Crystal Report OCX is stripping excess consecutive SPACES from the entire SQL Query Command. That is great except it should not be stripping any consecutive spaces from inside the SINGLE QUOTED STRING LITERAL. This makes the WHERE Clause fail only for certain new Part Numbers that now have consecutive spaces in them. The PartNum is actually appended to the VB6 String just before the Crystal Report is activated but was shown here as a constant just for clarity purposes. The Crystal Report works perfectly if there are not consecutive spaces in the Part Number but it selects no Part Number if there are consecutives spaces in the Part Number.

Is this a known bug?
Is there Crystal Setting that I can change to fix this?

Thank You,

This post has been edited by gklocek: 29 July 2008 - 03:59 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1