Solved

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

Posted on 2004-03-29
10
1,035 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 7

Expert Comment

by:ramesh12
ID: 10707882
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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 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