VB6 - CR7 - SQL Server - Want to send either SQL or ADO recordset to report 
Author Message
 VB6 - CR7 - SQL Server - Want to send either SQL or ADO recordset to report

A dumptruck full of good karma to the person who helps me solve this
one...

I'm using the CR7 OCX in a VB6 project (no, I'd rather not switch to
the RDC at this point).

I have created a report based on a TTX and at runtime I want to
either:

1) Send a pre-built SQL statement to the report, along with .Connect
information for a user-specified SQL Server database

or

2) Send an ADO Recordset directly to the report

Obviously, the SQL statement (or the Recordset) will have columns
exactly matching the TTX file.

No matter what I have tried so far, I always get error 20599, "Cannot
open SQL server".

Note that basing the report on a TTX is NOT a requirement. The only
requirement is that I am able to build a query at runtime and send
either that query's SQL or an ADO recordset to a Crystal Report, using
the OCX.

The ONLY way I've been able to come even close is to build the report
directly against SQL Server, then change the DSN information at
runtime. Problem is, the queries I want to use to run the reports are
far more complex than I want to try to emulate using CR7's
data-joiner. It'll be much much easier for me if the VB program can
just generate the SQL and then send it off, or run it and provide an
ADO recordset.

Thanks in advance,
-Mike



Sat, 20 Aug 2005 05:10:46 GMT  
 VB6 - CR7 - SQL Server - Want to send either SQL or ADO recordset to report
Hello there Mike... I am currently using CR 8.5 and I don't know if this
will help, but this is what I do,

Public Sub subRepInt(ByRef crxRep As CRAXDDRT.Report, ByRef cnnDB As
ADODB.Connection, ByVal strQuery As String)

Dim intCount As Integer

    crxRep.Database.SetDataSource gstrSDN        'gstrSDN is a global
variable that has the DSN Name
    For intCount = 1 To crxRep.Database.Tables.Count
        crxRep.Database.Tables(intCount).SetLogOnInfo gstrSDN, gstrDBName,
gstrDBUser, gstrDBPass           'Same for gstrSDN, gstrDBName is the DB
name,

'gstrUser is the DBServer User and ths gstrPass is

'the DBServer Password
        crxRep.Database.Tables(intCount).Location =
crxRep.Database.Tables(intCount).Name
    Next intCount

    crxRep.SQLQueryString = strQuery

End Sub

Hope this helps....

--
Saludos.
Edgar Contreras

(Gua de netiquette del foro)
http://perso.wanadoo.es/rubenvigon/foro

"La informacion es presentada como es y sin garantia alguna"


Quote:
> A dumptruck full of good karma to the person who helps me solve this
> one...

> I'm using the CR7 OCX in a VB6 project (no, I'd rather not switch to
> the RDC at this point).

> I have created a report based on a TTX and at runtime I want to
> either:

> 1) Send a pre-built SQL statement to the report, along with .Connect
> information for a user-specified SQL Server database

> or

> 2) Send an ADO Recordset directly to the report

> Obviously, the SQL statement (or the Recordset) will have columns
> exactly matching the TTX file.

> No matter what I have tried so far, I always get error 20599, "Cannot
> open SQL server".

> Note that basing the report on a TTX is NOT a requirement. The only
> requirement is that I am able to build a query at runtime and send
> either that query's SQL or an ADO recordset to a Crystal report, using
> the OCX.

> The ONLY way I've been able to come even close is to build the report
> directly against SQL Server, then change the DSN information at
> runtime. Problem is, the queries I want to use to run the reports are
> far more complex than I want to try to emulate using CR7's
> data-joiner. It'll be much much easier for me if the VB program can
> just generate the SQL and then send it off, or run it and provide an
> ADO recordset.

> Thanks in advance,
> -Mike



Sun, 21 Aug 2005 03:34:35 GMT  
 VB6 - CR7 - SQL Server - Want to send either SQL or ADO recordset to report


Fri, 19 Jun 1992 00:00:00 GMT  
 VB6 - CR7 - SQL Server - Want to send either SQL or ADO recordset to report
I am using CR7.0 with VB6.0.
I am not passing any sql query but just filtering records using
selection formula. For 2 or 3 days, it worked well and I got the
desired output. But not I am getting the runtime error 20559 "Cannot
open sql server".

Can anybody help me?
Rashmi.

Quote:

> Hello there Mike... I am currently using CR 8.5 and I don't know if this
> will help, but this is what I do,

> Public Sub subRepInt(ByRef crxRep As CRAXDDRT.Report, ByRef cnnDB As
> ADODB.Connection, ByVal strQuery As String)

> Dim intCount As Integer

>     crxRep.Database.SetDataSource gstrSDN        'gstrSDN is a global
> variable that has the DSN Name
>     For intCount = 1 To crxRep.Database.Tables.Count
>         crxRep.Database.Tables(intCount).SetLogOnInfo gstrSDN, gstrDBName,
> gstrDBUser, gstrDBPass           'Same for gstrSDN, gstrDBName is the DB
> name,

> 'gstrUser is the DBServer User and ths gstrPass is

> 'the DBServer Password
>         crxRep.Database.Tables(intCount).Location =
> crxRep.Database.Tables(intCount).Name
>     Next intCount

>     crxRep.SQLQueryString = strQuery

> End Sub

> Hope this helps....

> --
> Saludos.
> Edgar Contreras

> (Gua de netiquette del foro)
> http://perso.wanadoo.es/rubenvigon/foro

> "La informacion es presentada como es y sin garantia alguna"



> > A dumptruck full of good karma to the person who helps me solve this
> > one...

> > I'm using the CR7 OCX in a VB6 project (no, I'd rather not switch to
> > the RDC at this point).

> > I have created a report based on a TTX and at runtime I want to
> > either:

> > 1) Send a pre-built SQL statement to the report, along with .Connect
> > information for a user-specified SQL Server database

> > or

> > 2) Send an ADO Recordset directly to the report

> > Obviously, the SQL statement (or the Recordset) will have columns
> > exactly matching the TTX file.

> > No matter what I have tried so far, I always get error 20599, "Cannot
> > open SQL server".

> > Note that basing the report on a TTX is NOT a requirement. The only
> > requirement is that I am able to build a query at runtime and send
> > either that query's SQL or an ADO recordset to a Crystal report, using
> > the OCX.

> > The ONLY way I've been able to come even close is to build the report
> > directly against SQL Server, then change the DSN information at
> > runtime. Problem is, the queries I want to use to run the reports are
> > far more complex than I want to try to emulate using CR7's
> > data-joiner. It'll be much much easier for me if the VB program can
> > just generate the SQL and then send it off, or run it and provide an
> > ADO recordset.

> > Thanks in advance,
> > -Mike



Sun, 21 Aug 2005 22:36:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. ADO Problem: VB6 hangs on sending a query to an SQL-Server 2000

2. VB6: Oracle 8/SQL Server 2000 compatibility problems using ADO 2.5 and SQL

3. VB6: Oracle 8/SQL Server 2000 compatibility problems using ADO 2.5 and SQL Syntax

4. VB6: Oracle 8/SQL Server 2000 compatibility problems using ADO 2.5 and SQL Syntax

5. New Stored Procedure Parameter (SQL Server 7) isn't recognized in CR7 Report Designer

6. VB Sql Server Via ADO Problem: [Microsoft][ODBC Sql Server Driver]

7. VB6 application using SQL Server 2000 migrating db to SQL Server 2

8. Using either recordsets or select or sql.

9. Send stand-alone ADO recordset to SQL procedure

10. Important FYI - Multiple Recordsets w ADO/SQL Server

11. Important FYI - Multiple Recordsets w ADO/SQL Server

12. Indexes in SQL Server with ADO Recordset

 

 
Powered by phpBB® Forum Software