Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005-2015 : Report Design
Message Icon Topic: Database Logon Fail Post Reply Post New Topic
<< Prev Page  of 2
Author Message

Joined: 25 Jun 2012
Online Status: Offline
Posts: 19
Quote rushelp Replybullet Posted: 03 Aug 2012 at 8:04am
I do have one crystal report viewer which shows all the clients by their ID. Once I open the program, it asks which ID I want to show the report for in the viewer. I select all of them. However, the view and the files that getting generated into pdf are not tied together. I don't know what to do then.

What I'm doing with reports for each checkbox is getting the path.

private void save_Click(object sender, EventArgs e)
var reportPaths =
from ctrl in panel1.Controls.OfType<CheckBox>()
let reportPath = ctrl.Tag as string
where ctrl.Checked && !string.IsNullOrEmpty(reportPath)
select reportPath;
foreach (string reportPath in reportPaths)

Then this is how I export.

private void ExportReport(string reportPath)
            //uploads crystal file
            string fileName = Path.GetFileName(reportPath);
            ReportDocument report = new ReportDocument();
            report.SetDatabaseLogon("user", "pass", "server", "database");
            //file path where pdf's are stored
            string destination = @"...\convertedpdf\{0}_DetailedCallReport_{1:yyyyMM}.pdf";
            DirectoryInfo tempPathPdfDirName = Directory.CreateDirectory(Path.Combine(System.IO.Path.GetTempPath(),
            string tempPdfFileName = Path.Combine(tempPathPdfDirName.FullName, destination);
               ExportOptions options = report.ExportOptions;
               options.ExportDestinationType = ExportDestinationType.DiskFile;
               options.ExportFormatType = ExportFormatType.PortableDocFormat;
               options.DestinationOptions = new DiskFileDestinationOptions()
                    DiskFileName = String.Format(

               options.FormatOptions = new PdfRtfWordFormatOptions();

            catch (Exception ex)


Any help, on how I can bypass that parameter?
IP IP Logged
Admin Group
Admin Group

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3678
Quote hilfy Replybullet Posted: 06 Aug 2012 at 3:12am
In the report, try setting the parameter as optional and giving it a default value.
IP IP Logged

Joined: 09 Dec 2012
Online Status: Offline
Posts: 2
Quote awardhan Replybullet Posted: 09 Dec 2012 at 4:40pm

I am actually having a similar problem.
We are using cr for vs.net2010 (14.0.2000.0) and SQLExpress 2008r2 database.

The database connection seems to work fine in the following environment:
1. Dev
2. Old production box
And also for a brand new report.(apparently I can't afford to rewrite all the reports)

However, this doesn't work in the new production environment. I have checked if sql native client is installed, and it has.

I tested the database connectivity using the following code:

ReportDocument rd = new ReportDocument();
rd.SetParameterValue("@invoiceID", invoiceID);

ConnectionInfo myConnectionInfo = new ConnectionInfo();
myConnectionInfo.ServerName = server;
myConnectionInfo.UserID = username;
myConnectionInfo.Password = password;
myConnectionInfo.DatabaseName = database;

Tables tbls = rd.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in tbls)
TableLogOnInfo info = tbl.LogOnInfo;
info.ConnectionInfo = myConnectionInfo;
bool b = tbl.TestConnectivity();
if (!b)
throw new Exception("main connection failed");

And it always got into "main connection failed".
I am not sure if I miss anything...
Any help would be appreciated,

Thank you,

Edited by awardhan - 09 Dec 2012 at 5:11pm
IP IP Logged

Joined: 09 Dec 2012
Online Status: Offline
Posts: 2
Quote awardhan Replybullet Posted: 09 Dec 2012 at 5:24pm
Please ignore my message.

I had to change from (local) to ".\sqlexpress".
It seems like I have to use ".\sqlexpress", for sql express it doesn't work for (local).

Thank you,
IP IP Logged
<< Prev Page  of 2
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

This page was generated in 0.016 seconds.