如题 我的数据集为
Dim conn As New SqlConnection
conn.ConnectionString = "server=.; database=qcgl ;uid=sa ; pwd=111111"
Dim strsql As String
strsql = "SELECT dbo.Department.De_name AS 部门名称, dbo.officefee.officefee AS 办公室费用, dbo.officefee.paper AS 复印纸费用, dbo.officefee.xiaoji AS 小计, dbo.officefee.detail AS 细节, dbo.officefee.office_date AS 发生日期, dbo.officefee.officedengji_date AS 登记日期 FROM dbo.officefee INNER JOIN dbo.Department ON dbo.officefee.De_id = dbo.Department.De_id where De_name='" & DropDownList1.SelectedItem.Text & "'and office_date between '" & TextBox2.Text & "' and '" & TextBox3.Text & "' ORDER BY dbo.officefee.office_date DESC"
conn.Open()
Dim cmd As New SqlCommand(strsql, conn)
Dim adp As New SqlDataAdapter(cmd)
Dim ds As New DataSet
adp.Fill(ds, "qcgl")
DataGrid1.DataSource = ds.Tables("qcgl").DefaultView
DataGrid1.DataBind()
如何在datagrid页面最后一行中动态生成一个合计列
也可以给出其他VB实例 便于我在VS中实验
合计行 只统计 费用 其他列为空如图
部门 费用1 费用2 细节 日期
a 1 2 XXX 2009/1/1
b 2 3 XXX 2009/2/2
合计 3 5