我已经开始使用crystal reports
. 我可以使用dataset
除sql
.auto-row numbering
这是我的代码:
SqlConnection cnn;
string connectionString = null;
string sql = null;
connectionString = "data source=Kim; initial catalog=DBO;user id=sa; password=passw0rd";
cnn = new SqlConnection(connectionString);
cnn.Open();
sql = "select Name as DataColumn1, Age as DataColumn2, from tbl1";
SqlDataAdapter dscmd = new SqlDataAdapter(sql, cnn);
cnn.Close();
DataSet2 ds = new DataSet2();
dscmd.Fill(ds, "DataTable2");
CrystalReport1 objRpt = new CrystalReport1 ();
objRpt.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource = objRpt;
CrystalReportViewer1.RefreshReport();
报告的结果是这样的:
No Name Age
Kim 22
Ian 29
Aris 27
需要显示这样的报告:
No Name Age
1 Kim 22
2 Ian 29
3 Aris 27
你能告诉我如何添加行号吗?