Its possible if I can my variable "strBilanzTitel" see into my crystal
reports?
How?
My code:
----------
namespace FiBu
{
public class frmFiBuKontenplanAnsehenBilanz : System.Windows.Forms.Form
{
private CrystalDecisions.Windows.Forms.CrystalReportViewer
crystalReportViewer1;
private System.ComponentModel.Container components = null;
private SqlConnection sqlCN;
BerichtFiBuKontenplanAnsehenBilanz crReportDocument;
int intMandantID = frmHauptmenue.IntMandantID;
string strBilanzTitel ="";
public frmFiBuKontenplanAnsehenBilanz(string strpBilanzTitel)
{
InitializeComponent();
strBilanzTitel = strpBilanzTitel;
}
private void crystalReportViewer1_Load(object sender, System.EventArgs e)
{
//Build a connection string
string strConnectionString= "";
//Instanzieren der Klasse Configuration um später aus der
configuration.xml lesen zu können
Configuration myCon = new Configuration();
strConnectionString = myCon.configurationsdaten_einlesen();
//Ein Objekt für die Serververbindung ADO.NET wird instanziert
sqlCN = new SqlConnection(strConnectionString);
//Build a SQL statement to query the datasource
string sqlQuerry = "";
sqlQuerry = "Select * From tblFiBuKontenplan "+
"WHERE FiBuKontenplanMandantID ="+frmHauptmenue.IntMandantID;
//Retrieve the data using the SQL statement and existing connection
SqlDataAdapter sqlDA = new SqlDataAdapter(sqlQuerry, sqlCN);
try
{
//Verbindung öffnen
sqlCN.Open();
DataSet DS = new DataSet();
sqlDA.Fill(DS, "tblFiBuKontenplan");
//Create an instance of the strongly-typed report object
crReportDocument = new BerichtFiBuKontenplanAnsehenBilanz();
//Pass the populated dataset to the report
crReportDocument.SetDataSource(DS);
//Set the viewer to the report object to be previewed.
crystalReportViewer1.ReportSource = crReportDocument;
this.crystalReportViewer1.Zoom(70);
}
catch (SqlException sqlExcp)
{
//Bei fehlerhaftem Zugriff wird Fehlermeldung ausgelöst
MessageBox.Show(this, sqlExcp.ToString(), "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
finally
{
sqlCN.Dispose();
sqlDA.Dispose();
}
}
}
}
Thanks Michael