Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Crystal reports with C#, Displays a error message.

Crystal reports with C#, Displays a error message.

Scheduled Pinned Locked Moved C#
databasecsharpmysqlvisual-studiowpf
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3950922
    wrote on last edited by
    #1

    Hi , I am trying to display a crystal report using the crystal report viewer in vs 2008,and it does not display instead it gives a database login screen. This is the code which I am using . ================================================================== CrystalReport1 objRpt; //Usermaster objRpt; objRpt = new CrystalReport1(); string connstr = "Persist Security Info=False;userid=btssys; password=xx23;database=bts;server=xxxx"; MySqlConnection mc = new MySqlConnection(connstr); try { mc.Open(); string sql = "select userid, usergiven,userfamily,status,expiry,created,created_by from user_master"; MySqlCommand cmd = new MySqlCommand(sql, mc); MySqlDataAdapter adp = new MySqlDataAdapter(sql, mc); //new MySqlDataAdapter( DataSet ds = new DataSet(); int li_rows = adp.Fill(ds, "myds"); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("No data Found", "CrystalReportWithmysql"); return; } // Setting data source of our report object objRpt.SetDataSource(ds); // Binding the crystalReportViewer with our report object. crystalReportViewer1.ReportSource = objRpt; ================================================================================ If I debug I can find that the ds is retrieving the rows. But nothing comes up on the crystal report viewer.It displays a database login screen instead with server name as myds. Is this something to do with Mysql or something wrong with VS 2008 or crystal report coding. Thanks

    U 1 Reply Last reply
    0
    • U User 3950922

      Hi , I am trying to display a crystal report using the crystal report viewer in vs 2008,and it does not display instead it gives a database login screen. This is the code which I am using . ================================================================== CrystalReport1 objRpt; //Usermaster objRpt; objRpt = new CrystalReport1(); string connstr = "Persist Security Info=False;userid=btssys; password=xx23;database=bts;server=xxxx"; MySqlConnection mc = new MySqlConnection(connstr); try { mc.Open(); string sql = "select userid, usergiven,userfamily,status,expiry,created,created_by from user_master"; MySqlCommand cmd = new MySqlCommand(sql, mc); MySqlDataAdapter adp = new MySqlDataAdapter(sql, mc); //new MySqlDataAdapter( DataSet ds = new DataSet(); int li_rows = adp.Fill(ds, "myds"); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("No data Found", "CrystalReportWithmysql"); return; } // Setting data source of our report object objRpt.SetDataSource(ds); // Binding the crystalReportViewer with our report object. crystalReportViewer1.ReportSource = objRpt; ================================================================================ If I debug I can find that the ds is retrieving the rows. But nothing comes up on the crystal report viewer.It displays a database login screen instead with server name as myds. Is this something to do with Mysql or something wrong with VS 2008 or crystal report coding. Thanks

      U Offline
      U Offline
      User 3950922
      wrote on last edited by
      #2

      Hi all, I resolved it myself, change the DataSet ds = new DataSet(); int li_rows = adp.Fill(ds, "myds"); I used a datatable and changed the retrieval to adp.fille(dt) ; objRpt.SetDataSource(dt); and it works any ways, thanks everyone.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups