Crystal Reports and c# form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zaider
    New Member
    • Jan 2008
    • 4

    Crystal Reports and c# form

    I have a c# form with some text boxes and a datagrid view that I want to put onto a crystal report via a button. I have tried creating a ds from the same data that is in the datagridview and puting it as the datasource for the report but all I end up with is a blank form. This is what I tried. I would also like to be able to add the information in the textboxes to the report but am unsure of how I would add that extra data.
    Code:
    OleDbDataAdapter oleDbDataAdapter = null;
    DataSet ds = new DataSet();
    OleDbCommand cmd = null;
    OleDbConnection connectCmd = new OleDbConnection(dbConnect);
    
    string sqlString3 = "Select * From QuoteDetail Where QuoteHeaderID = " + newOrderHeader; 
    
    cmd = new OleDbCommand(sqlString3, connectCmd);
    cmd.Connection.Open();
    cmd.ExecuteNonQuery();
    oleDbDataAdapter = new OleDbDataAdapter(cmd);
    oleDbDataAdapter.Fill(ds);
    cmd.Connection.Close();
     
    
    CrystalReport2 myReport = new CrystalReport2();
    myReport.SetDataSource(ds);
    crystalReportViewer1.ReportSource = myReport;
Working...