我是新来的报告。我正在使用 MicrosoftaReportViewr 来显示报告。为此,我创建并填充了数据集。然后我尝试将该数据集作为reportviewr1 的源。但我没有得到实际的编码。我的代码是
if (cbReprt.Text == "FirmDetails")
{
ReportDocument rpt = new ReportDocument();
rpt.Load("C:\\Users\\ALEN\\Desktop\\Merchant\\MerchantAssociation\\MerchantAssociation\\CrystalReport1.rpt");
SqlConnection myCon;
SqlDataAdapter myAdapter;
DataSet1 myDataset = new DataSet1(); //The DataSet you created.
myCon = new SqlConnection("Data Source=202.88.231.102;Initial Catalog=dbs_Merchant;Persist Security Info=True;User ID=sa;Password=abc123*");
SqlCommand cmd3 = new SqlCommand("select * from View1", myCon);
cmd3.CommandType = CommandType.StoredProcedure;
myAdapter = new SqlDataAdapter(cmd3);
myAdapter.Fill(myDataset, "View1");
rpt.SetDataSource(myDataset);
reportViewer1.LocalReport.DataSources= rpt;
reportViewer1.RefreshReport();
}
但我 reportViewer1.LocalReport.DataSources=rpt; 显示错误...是否需要任何特殊的命名空间?