on 03-17-2009 3:53 PM
Hi,
I have a report which is bind with a stored proc (sp). I know how to change the server and database for the report but the report's database stay the same
Is it possible to change the database for the stored proc (catalogue) ???
(i'm using C#)
Thank you in advance
Regards
Hi,
Try this code
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "SERVER";
crConnectionInfo.DatabaseName = "DATABASE";
crConnectionInfo.UserID = "USERID";
crConnectionInfo.Password = "PASSWORD";
// Use a loop to go through all the tables in the main report
foreach(Table crTable in crReportDocument.Database.Tables)
{
// Get the TableLogOnInfo from the Table and then set the new
// ConnectionInfo values.
TableLogOnInfo crLogOnInfo = crTable.LogOnInfo;
crLogOnInfo.ConnectionInfo = crConnectionInfo;
// Apply the TableLogOnInfo
crTable.ApplyLogOnInfo(crLogOnInfo);
// Set the location of the database. This value will vary from // database to database.
crTable.Location = crTable.Location;
}
Hope this will help!!
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
I have always a "COMException" on the line. But my aim is possible directly in CR
Configuration :
- VSS 2008
- Sybase
- CR XI
I tryed
TableLogOnInfo LogInfo = new TableLogOnInfo();
int i = mReport.Database.Tables.Count;
LogInfo.ConnectionInfo.ServerName="ISAIN_DEV";
LogInfo.ConnectionInfo.UserID="";
LogInfo.ConnectionInfo.Password="";
LogInfo.ConnectionInfo.DatabaseName="espagne";
for (int j = 0; j < i-1; j++)
{
mReport.Database.Tables[j].ApplyLogOnInfo(LogInfo);
}
I just arrive to show the report empty in the CrystalReportViewer...
Thank you for your help
Edited by: koyot3 on Mar 19, 2009 8:31 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please clarify:
"i catch anything...."
Does this mean you have try/catch in your code? If you add the try/catch to just the logon routine does that capture the error?
Also, is ISAIN_DEV your server name or the ODBC DSN?
Have you verified the report and logon info youa re setting in code works in CR DEsigner also?
Please let us know if desired functionality is possible through the CR Designer through the 'Set Datasource Location | Update ' option
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thank you for your answer but it doesn't work
i have a ComException on
crTable.ApplyLogOnInfo(crLogOnInfo)
"not valid pointer"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.