I am trying to execute the crystal report with below code but I dont know what is going wrong . Here is my connection class to mysql -------------------------------------------------------------------------------------
I am trying to execute the crystal report with below code but I dont know what is going wrong .
Here is my connection class to mysql
-------------------------------------------------------------------------------------
namespace schoolbell
{
class con_db
private static string Database = "scbell";
private static string Server = "localhost";
private static string Password = "";
private static string Username = "";
private static string constring = "Server=" + Server + ";" + "Database=" + Database + ";" + "Uid=" + Username + ";" + "Password=" + Password + ";";
public static MySqlConnection con = new MySqlConnection(constring);
public con_db()
}
======================== try
========================
try
Cursor = Cursors.WaitCursor;
timer1.Enabled = true;
CrystalReport3 rpt = new CrystalReport3();
MySqlCommand con = new MySqlCommand();
MySqlDataAdapter myda = new MySqlDataAdapter();
DataSet myds = new DataSet();
con = new MySqlConnection(con_db.con); // Here I have error
// Here I have error
con.Connection = MySqlCommand(con_db.con); //
con.Connection = MySqlCommand(con_db.con);
//
con.CommandText = " select *from feest ";
con.CommandType = CommandType.Text;
myda.SelectCommand = con;
myda.Fill(myds,"feest");
rpt.SetDataSource(myds);
feestru fm = new feestru();
fm.crystalReportViewer1.ReportSource = rpt;
fm.Visible = true;
catch (Exception ex)
MessageBox.Show(ex.StackTrace,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
} Regards anand
Regards
anand