c# winform水晶报表怎么填充 datadet

2024-12-18 00:41:02
推荐回答(1个)
回答1:

//绑定按钮代码,winform

string strCon = WaterPlan.Properties.Settings.Default.ConnectionString1.ToString();
DataSet ds = new DataSet(strCon);
string strQuery = "这里填写应该有的sql语句";
SqlDataAdapter sda = new SqlDataAdapter(strQuery, strCon);
sda.Fill(ds, "表名");
CrystalReport1 cr = new CrystalReport1();
cr.SetDataSource(ds);
crystalReportViewer1.ReportSource = cr;