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
Solved

CRYSTAL REPORTS 9 -SET DATA SOURCE LOCATION PROBLEM

Posted on 2003-11-29
5
514 Views
Last Modified: 2012-05-04
query regarding CRYSTAL REPORTS 9:
actually what i needed is,when adding any database fields in the design view.when i see the sql

query dialog box automatically,the database name gets added in front of the tables .so the

problem is when i change the database ,the report gives error like "field names not known"
0
Comment
Question by:ashok_btech
5 Comments
 
LVL 13

Accepted Solution

by:
EwaldL earned 168 total points
ID: 9842015
using the set location command in the crystal reports designer you shouldnt have any problem changing the database. this should be done for you. so i assume you are changing the database at runtime? if so, you need to change the table location. here is some vb6 / rdc 9 code that should take care of this. i hope this helps, but let me know in case i misunderstood the question or in case you are using some other object model

Dim myReport As CRAXDRT.Report
Dim myTable As CRAXDRT.DatabaseTable
For Each myTable In myReport.Database.Tables
  myTable.ConnectionProperties("Data Source") = "NewSqlServer"
  myTable.ConnectionProperties("Database") = "newDatabase"
  myTable.ConnectionProperties("Password") = "ThePassword"
  myTable.ConnectionProperties("User ID") = "TheUser"
  myTable.Location "NewDatabase.dbo." + myTable.Name
Next
0
 
LVL 1

Assisted Solution

by:yuniar
yuniar earned 166 total points
ID: 9846945
This problem has been fixed in Crystal Reports patch.
Have you deploy Crystal Report 9 patch?
0
 

Assisted Solution

by:yadav_surender
yadav_surender earned 166 total points
ID: 9940819
For setting the databaes at runtime use the following code

First declare the recordset of that table which you are using the report
then write the following code
Report.Database.SetDatasource rs,3,1  'rs is the recordset of that  table which you are using

If you are using more than one table then you can use another recordset
Report.Database.SetDatasource rs23,2 'rs2 the recordset of thoe second table

Cheers
Surender
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

829 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