Access Crystal reports from C#.NET

D

Dilini Ginige

Hi,

I need to open a crystal report through the crystalreportform viewer
in a C# project.

I used a view in the crystal report.But even when I give the logoninfo
from the code the dialog box to login to the database promts from the
application.

The coding I used is as follows.

public TableLogOnInfos AddLogOnInfo(TableLogOnInfos
tableLogOnInfos,string strViewName)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();

// Set the connection information for the table in the report.
logOnInfo.ConnectionInfo.ServerName = sqlServer;
logOnInfo.ConnectionInfo.DatabaseName = sqlDataBase;
logOnInfo.ConnectionInfo.UserID = sqlUserID;
logOnInfo.ConnectionInfo.Password = sqlPassword;
logOnInfo.TableName = strViewName;

// Add the logoninfo to the logOnInfos collection.
tableLogOnInfos.Add (logOnInfo);
return tableLogOnInfos;
}


If anybody knows whats wrong with this .Can u pls let me know.

Is it because I have assumed the view to be same as a table.??

Thx
Dilini
 
C

Chad Z. Hower aka Kudzu

(e-mail address removed) (Dilini Ginige) wrote in
Hi,

I need to open a crystal report through the crystalreportform viewer
in a C# project.

I used a view in the crystal report.But even when I give the logoninfo
from the code the dialog box to login to the database promts from the
application.

The coding I used is as follows.

public TableLogOnInfos AddLogOnInfo(TableLogOnInfos
tableLogOnInfos,string strViewName)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();

// Set the connection information for the table in the
report. logOnInfo.ConnectionInfo.ServerName = sqlServer;
logOnInfo.ConnectionInfo.DatabaseName = sqlDataBase;
logOnInfo.ConnectionInfo.UserID = sqlUserID;
logOnInfo.ConnectionInfo.Password = sqlPassword;
logOnInfo.TableName = strViewName;

// Add the logoninfo to the logOnInfos collection.
tableLogOnInfos.Add (logOnInfo);
return tableLogOnInfos;
}


If anybody knows whats wrong with this .Can u pls let me know.

Is it because I have assumed the view to be same as a table.??

Thx
Dilini



--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"


ELKNews - Get your free copy at http://www.atozedsoftware.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top