Click here to Skip to main content
15,881,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i write following code for a crystal report but it show empty report. why?

string sqlCon = "User ID=sa;server=mycomputer;INITIAL CATALOG=bank_j;";


string sqlstr = @"select code_fa from dbo.mytable
where code_fa = 17 ";


DataSet ds = new DataSet();
SqlConnection cnn = new SqlConnection(sqlCon);
SqlCommand cmd = new SqlCommand(sqlstr, cnn);
cmd.CommandType = CommandType.Text;
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds, "ttable");
cnn.Open();


CrystalReport2 rpt = new CrystalReport2();
rpt.SetDataSource(ds);
crystalReportViewer1.ReportSource = rpt;
crystalReportViewer1.Refresh();


Thanks
Posted
Comments
Sinisa Hajnal 24-Dec-14 4:36am    
Because your dataset is empty? Did you check? Check each step, set fixed label on the report so you can check that it isn't some error on the report itself. You'll find it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900