Hey.
Sory for C#...

I have report created in CR 11 Pro:

In Database -> Set datadource location:

HTML Code:
MyServer\sql_2005
   -> Properties
        Database Type: ODBC (RDO)
        Connection String: DRIVER={SQL Server};SERVER=MyServer\sql_2005;DATABASE=CRDataBase
        User ID: MyUser
        Database: CRDataBase
        SERVER: MyServer\sql_2005
        Use DSN Default Properties: False
and for each table like this:
HTML Code:
   -> Magazyny
        -> Properties
            Table Name: Magazyny 
            Table Type: Tables
            Catalog: CRDataBase
            Owner: MyUser
Setting: Save data with Report = off

Ok. I try to use this file in crystal viewer control.


Code:
crReport = crApp.OpenReport(@"C:\Raport1.rpt", 1);

crReport.DiscardSavedData();

k_Viewer.ReportSource = crReport;
k_Viewer.ViewReport();
And the report run fine but when i change (in SQL Server Management Studio) the name of database from CRDataBase to XDataBase i have error:

System.Runtime.InteropServices.COMException (0x80047E48): Logon failed.
Details: 01S00:[Microsoft][ODBC SQL Server Driver]Invalid connection string attribute.


Logon failed couse database name has changed.

so a try to change connection string for each tables:
full code:
Code:
crReport = crApp.OpenReport(@"C:\Raport1.rpt", 1);

crReport.DiscardSavedData();

for (int i = 1; i < crReport.Database.Tables.Count; i++)
{
crReport.Database.Tables[i].ConnectionProperties.DeleteAll();
crReport.Database.Tables[i].ConnectionProperties.Add("Connection String", @"Driver=SQL Server;Server=" + _Server + ";Database=" + _DataBase + ";UID=MyUser;PWD=");
}

k_Viewer.ReportSource = crReport;
k_Viewer.ViewReport();
and the next error:

System.Runtime.InteropServices.COMException (0x80047E44): The table '' could not be found.

what the ... ??

ok.. i try to change database name to old "CRDataBase" and all run fine.
so a created new database with name "CRNew" withe the same structures as "CRDataBase".

report run fine but data was loaded from old database.

so i try to change location of all tables:
full code:

Code:
crReport = crApp.OpenReport(@"C:\Raport1.rpt", 1);

crReport.DiscardSavedData();

for (int i = 1; i < crReport.Database.Tables.Count; i++)
{
String oldLocation = crReport.Database.Tables[i].Location;

crReport.Database.Tables[i].ConnectionProperties.DeleteAll();
crReport.Database.Tables[i].ConnectionProperties.Add("Connection String", @"Driver=SQL Server;Server=" + _Server + ";Database=" + _DataBase + ";UID=MyUser;PWD=");

String newLocation = _DataBase + "." + "MyUser" + "." + oldLocation;
crReport.Database.Tables[i].Location = newLocation;

}

k_Viewer.ReportSource = crReport;
k_Viewer.ViewReport();
and data from new database was loaded...

ok.. at the and i delete the old database "CRDataBase" i **** the same error:

System.Runtime.InteropServices.COMException (0x80047E44): The table '' could not be found.

what the... ??

what is with this report ??
why after the changing connection string report do not work on other database??

what else i must do ?

2 fu*** day and nothing..

i must figure this today...