You need to apply logon info to the report before showing it. Here I am
getting the logon info from config file.
Check this code for doing the same. Hope its helpful
Database crDataBase;
Tables crTables;
TableLogOnInfo crTableLogOnInfo;
ConnectionInfo reportConnectionInfo = new ConnectionInfo();
reportConnectionInfo.ServerName =
ConfigurationSettings.AppSettings.Get("serverName" );
reportConnectionInfo.DatabaseName =
ConfigurationSettings.AppSettings.Get("DatabaseNam e");
reportConnectionInfo.UserID =
ConfigurationSettings.AppSettings.Get("UserID");
reportConnectionInfo.Password =
ConfigurationSettings.AppSettings.Get("Password");
//Dummyprint is the CR report file.
Dummyprint dummyrep = new Dummyprint();
DataBase crDataBase = dummyrep.Database;
crTables = crDataBase.Tables;
foreach (Table crTable in crTables) {
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = reportConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
Regards,
Sanjeevakumar Hiremath.
Proteans Software Solutions
"Jason Huang" <Ja************@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl...
Hi,
I've created an ODBC connection with SQL Server 2000, for conneting to
MyDatabase.
In the process of building that ODBC connection, I test the connection and
fine with no problem.
However, in my C#.Net project, I add a CrystalReport MyReport to my
project,
then I test running MyReport, it will pop out a small box asking me to key
in DataBase, Username and Password again.
What do I need to do to let MyReport running without keying those data?
Thanks for help.
Jason