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
{
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
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

anand kulkarniPosted Oct 29, 2014, 5:16 AM
Sorry friend , but still my problem is remain same . The last link you gave is not useful for me :( . Just Please See the steps what i am doing or want to do .
1 I have connected to a Mysql database . ( Class Code is given it is connected successfully . No problem with that )
2 I am calling the same connection on FEES DEFINE form .
3 Here I am Adding some records .
4 with the help of user inputs i am showing particular years data in a grid ( THERE IS AL SO NO ISSUE EVERY THING IS GOING FINE )
5 With the help of user input I want to call parameterized query and show it as a crystal report .
6 When I Click on Report Button . The click event should execute the following things
connect again to the data base
call particular years data
and show it in a cry report .
( Here I have created cry report with the proper table i.e. Cryreport3 )
I think Now you can understand .
Regards
anand
Saineshwar BageriPosted Oct 28, 2014, 5:22 AM
Try this will work
http://csharpdotnetsol.blogspot.in/2013/09/crystal-reports-windows-forms.html
anand kulkarniPosted Oct 28, 2014, 5:04 AM
also please check this link . This form is Developed in Vfp9 .
http://www.c-sharpcorner.com/Forums/Thread/259864/pass-user-inputs-to-crystel-report.aspx
Regards
anand
Saineshwar BageriPosted Oct 28, 2014, 1:26 AM
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-stepbystep.htm
anand kulkarniPosted Oct 28, 2014, 1:04 AM
Saineshwar BageriPosted Oct 27, 2014, 8:43 AM
anand kulkarniPosted Oct 27, 2014, 2:05 AM
regards
anand
Saineshwar BageriPosted Oct 27, 2014, 12:18 AM
http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=9485754