Solved

How to Bind Crystal Report 8 with VB6 (ADO) and SQL 7

Posted on 2004-03-29
10
1,025 Views
Last Modified: 2012-06-21
Hi, I'm working with a program in VB6 with ADO, and a SQL 7 database. I need to show or print with crystal a recordset previously generated in the program, that is a mix of three tables. The report is okey, the preview shows me the result of all the records. And I know the recordset is okey too 'cause I show it in a grid. So, the problem is the linking of the recordset to the report.
I'll show the highlights of the code:
------------------------------------------------------------------------
'Connection
Private Const strCnnSQLServer="Provider=MSDATASHAPE;Data Provider=SQLOLEDB.1;Data Source=Server1;User ID=sa;PWD=trampa;Initial Catalog=Inventario"

Private cnnInventario  As New ADODB.Connection
cnnInventario.Open strCnnSQLServer
 
'Temporary recordset
Private cmdGridPcs   As New ADODB.Command
Private rsCmdGridPcs As New ADODB.Recordset

'Pc's table
cmdGridPcs.CommandType = adCmdText
cmdGridPcs.ActiveConnection = cnnInventario

'SQL query
cmdGridPcs.CommandText = "SELECT PcCode AS 'PC', (SELECT Model FROM ModelCpus WHERE  ModelCpus.Code=StockPcs.ModelCpuCode) AS 'CPU Model', (SELECT Description FROM Marks WHERE Marks.Code=StockPcs.MarkCode) AS 'Mark', (SELECT Description FROM ModelProcessors WHERE
ModelProcessors.Code=StockPcs.ProcessorCode) AS 'Processor', Memory AS 'Mem.', HardDisk AS 'HD', Net, CdDvd AS 'CD/DVD', Sound, SerialNumber AS '# Serial', StockNumber1 AS 'Stock #1', StockNumber2 AS 'Stock #2', Observations FROM StockPcs ORDER BY PcCode"

Set rsCmdGridPcs = cmdGridPcs.Execute
Set gridPcs.DataSource = rsCmdGridPcs

 
With crStockPcs
     .Connect = strCnnSQLServer
     .ReportFileName = App.Path & "\" & "StockPcs.Rpt"
     .SetTablePrivateData 0, 3, rsCmdGridPcs
     'Are offline        .DataFiles(0)=App.Path & "\" & rsCmdGridPcs.DataMember
     'Are offline        Set .DataSource=rsCmdGridPcs.DataSource
     .WindowBorderStyle = crptFixedSingle
     .WindowLeft = 0
     .WindowMaxButton = False
     .WindowMinButton = False
     .WindowState = crptMaximized
     .WindowTitle = "Pc's Stock Report"
     .WindowTop = 0
 
     .Action = 1
End With
------------------------------------------------------------------------

Thanks for you atenttion and your time. Regards.
0
Comment
Question by:pilotgabriel
  • 5
  • 4
10 Comments
 
LVL 7

Expert Comment

by:ramesh12
ID: 10707882
0
 
LVL 7

Expert Comment

by:ramesh12
ID: 10707913
0
 

Author Comment

by:pilotgabriel
ID: 10713444
Ramesh12,
the first example you gave me don't have any info about the thing I want, it is the connection exactly I'm doing it, okey ? If you should read the code I'm using, the you can figure out another idea of the problem. You see, the second example is different to the code I'm using. I downloaded I studied it, but it matter is that it uses the data environment to get the connection, but I'm using ADO without any data environment, okey ?
Maybe if you can read the highlights of the code I put below, you can find another idea to help me. I'm looking for anything I missed in the code, but I didn't find it.
Anyway, thanks for your atenttion and your time.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 7

Assisted Solution

by:ramesh12
ramesh12 earned 500 total points
ID: 10714984
Where is the code
0
 
LVL 7

Accepted Solution

by:
ramesh12 earned 500 total points
ID: 10714989
Oh I am sorry
0
 

Author Comment

by:pilotgabriel
ID: 10722963
The code is below, if you can see maybe you can tell me you is wrong with it, or what is missing, don't you ?
0
 

Author Comment

by:pilotgabriel
ID: 10980157
Please, I still need urgent the answer to the question I did.
0
 

Author Comment

by:pilotgabriel
ID: 11061574
500 points given to the trash !!! That is what that question was !!!
I needed URGENT a solution to this question. I made it a very long long time ago, and the answers I received did not match with the question. And then, a long time after that, I still remain without the answer I wanted. I had to search another sites and another people, but if I came first here was 'cause it was 'my place' ! But now I'm asking for help like I would be I poor man ! And I put 500 points to this question, so where's my answer ???!!!
ramesh12 helped me as I can, so I apreciate that so much ! So he is not guilty ! But the entire site and all the experts gives me his back and mocks of my, maintaining a question of 500 points without answering. I did this question to be answered, not just to lie in the in the fog during months. I'm very disappointed by the behavior of this site, so unless I receive the answer I need, I will no use it any longer, and very on the oposite, I will not recommend to my colleagues to come thie site, but to use others sites with better information and help.
0
 

Author Comment

by:pilotgabriel
ID: 11259522
I said sometime ago that I want to be removed from this site. Please do not send anymore e-mail to my address. If you continue to send anymore messages to my account I will consider it like SPAM. So, you can do that at once, then shutdown my account today.
Regards.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question