Solved

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

Posted on 2004-03-29
10
1,008 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
 
LVL 7

Assisted Solution

by:ramesh12
ramesh12 earned 500 total points
ID: 10714984
Where is the code
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now