Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SQLQueryString and SQL Server from Vb6 using CR9 RDC

Hi All,

Below is a snippet of my code:

myReportObj.Database.LogOnServer "crdb_odbc.dll", "myODBC-DSN", "myMSSQL-DB", "mySQLServerUserID", "mySQLServerPWD"

myReportObj.SQLQueryString = mySQLString

My Questions:


Why is Crystal (Vb6 with CR 9.0 RDC) generating the report with all the records in the myMSSQL-DB.table INSTEAD of ONLY the records that are restricted with the WHERE clause in the above (mySQLString).

The records are being pulled from a predefined VIEW on the SQL Server 2005.

The SQL Server 2005 VIEW is made up of two tables.

mySQLString is something like: SELECT name, amount, street FROM myMSSQL-DB.table WHERE name="john".

However, when the report gets generated, I get the records for John and ALSO those for Paul on the report.


When I tell the program/report to use MS ACCESS database instead of SQL Server 2005, everything work just fine. The report generates with ONLY records for John like it should.

Where should I begin to look to have this resolved? Doesn't SQLQueryString work with SQL Server 2005?

I have lots of CR Report (VB .DSR) that have always worked fine using MS ACCESS, I am now try to migrate to SQL Server 2005 as datasource (hopefully with as MINIMAL changes as possible), but just have lots of problems here and there!

Thanks All in advance.

Former Member

Until you move away from LogOnServer and start using the connecting properties, irrespective of it working with some reports, there is nothing I can do.

Let's continue this once you are using tested and supported way of doing things.


0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question