Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help please, using RDC with ADO.

Status
Not open for further replies.

geerae

Programmer
Aug 5, 2001
17
US
I have created a report using the designer in VB6.0. The report was created using 2 tables and utilitzing the ADO(Active Data Object). I have linked the tables and set the fields in question in the "Details" section of the report. The problem in when the report is viewed in the CRViewer using a SQL statement, many of my string fields are showing data from wrong fields.

For example a field named "ShipName" may actually have data from "ShipCity" etc. Only about half of the fields are wrong. These fields are in the first table added to the connection. I can't get any fields from the second table to show up. If I use data from the second table, when the report is loading I get a "File Not Found" error.

I have even tried creating a VIEW so I wouldn't have to link any tables but about half of the data fields are showing me the wrong data. At any time if I browse the data, everything looks fine.

In case someone has a better idea, all I need to do is pass different SQL statements through the same report. Currently I'm using the following

(SO is ADODB.Recordset)
(PassSQL is Global string equal to SQL statement being passed.)

If SO.State = 1 Then SO.Close
SO.Open PassSQL, SoftbaseDB, adOpenKeyset, adLockOptimistic
Call Report.Database.SetDataSource(SO)


Help please!!
Gary Comstock
 
I have found that if the fields in the recordset passed are not in the same order as the fields in the report's original recordset, you can get the wrong data.

If the passed recordset has extra fields, they should be on the end.

The syntax for SetDataSource usually (if not always) requires an argument that is the number 3 for active data. Ken Hamady, On-site/Phone Crystal Reports Training/Consulting
Quick Reference Guide to using Crystal in VB
 
Thanks Ken, I changed the order of the fields on the SQL statement and that did it!!

Gary
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top