468,103 Members | 1,222 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,103 developers. It's quick & easy.

Untyped Crystal report database connection Info

We are trying to use untyped reports in a C# application. Since the reports
are being written by a third party the connection information needs changed
at runtime. It will always be a ODBC SQL server database. I tried using a
function from Chapter17 of Brian Bischof's book "Crystal Reports .NET
Programming", however it does not work.

What am I missing?

private void
LogonToDatabase(CrystalDecisions.CrystalReports.En gine.ReportDocument report,
string serverName, string databaseName, string userId, string password)
{
CrystalDecisions.Shared.ConnectionInfo connectionInfo = new
CrystalDecisions.Shared.ConnectionInfo();

connectionInfo.ServerName = serverName;
connectionInfo.DatabaseName = databaseName;
connectionInfo.UserID = userId;
connectionInfo.Password = password;

foreach (CrystalDecisions.CrystalReports.Engine.Table table in
report.Database.Tables)
{
CrystalDecisions.Shared.TableLogOnInfo logonInfo = table.LogOnInfo;
logonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(logonInfo);

if (table.Location != table.Name)
{
table.Location = table.Name;
}
}
}
Jul 21 '05 #1
0 1403

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by codepuller | last post: by
3 posts views Thread by Deasun | last post: by
reply views Thread by Chris | last post: by
reply views Thread by khairihusseini | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.