Dim jlbh As String= e.Form.Controls("jlbh").value
Dim ysxdyear As String= e.Form.Controls("ysxdyear").value
Dim yszjly As String= e.Form.Controls("yszjly").value
Dim yszjxz As String= e.Form.Controls("yszjxz").value
Dim ysxdbm As String= e.Form.Controls("ysxdbm").value
Dim yswjbh As String= e.Form.Controls("yswjbh").value
Dim yswjbt As String= e.Form.Controls("yswjbt").value
Dim ysjehj As Integer= e.Form.Controls("ysjehj").value
Dim wjsmj As WinForm.FileManager = e.Form.Controls("FileManager1")
Dim lst As WinForm.Table = Forms("预算录入窗口").Controls("Table1")
'Dim dr As DataRow
Dim dt As DataTable
Dim cmd As New SQLCommand
cmd.Connectio n N ame = "cwgl"
If ysxdyear = "" OrElse yszjly = "" OrElse yszjxz = "" OrElse ysxdbm = "" OrElse yswjbt = "" OrElse ysjehj =0 Then
Messagebox.show("预算下达年度,资金来源,资金性质,下达部门,文件标题,预算金额合计不能为零或空值!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
cmd.CommandText = "Select Count(*) Fro m {预算录入主表} Where 记录编号 = '" & jlbh & "'"
If cmd.ExecuteScalar > 0 Then
Messagebox.show("增加记录编号失败,已经能存在同名记录编号!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
End If
cmd.CommandText = "Inser t I n to {预算录入主表} ([记录编号],[资金来源],[下达年度],[预算下达部门],[预算资金性质],[文件编号],[文件标题],[预算下达总金额],[附件]) Values ('"
cmd.CommandText = cmd.CommandText & jlbh & "','" & yszjly & "','" & ysxdyear & "','" & ysxdbm & "','"& yszjxz & "','" & yswjbh & "','" & yswjbt & "',ysjehj,wjsmj)"
If cmd.ExecuteNonQuery = 1 Then '返回1表示增加成功
If Forms("预算录入窗口").Opened Then
cmd.CommandText = "SELECT * Fro m {预算录入主表}"
dt = cmd.ExecuteReader()
Dim bd1 As New GroupTableBuilder("统计表1",dt)
bd1.Groups.AddDef("记录编号","记录编号") '根据根据用户账号分组
bd1.Groups.AddDef("资金来源","预算安排_资金来源") '根据用户姓名分组
bd1.Groups.AddDef("下达年度","预算安排_年度") '根据用户姓名分组
bd1.Groups.AddDef("预算下达部门","预算安排_下达部门") '根据所属部门分组
bd1.Groups.AddDef("预算资金性质","预算安排_资金性质") '根据用户角色分组
bd1.Groups.AddDef("文件编号","下达文件_文件编号") '根据用户密码分组
bd1.Groups.AddDef("文件标题","下达文件_文件内容") '根据用户密码分组
bd1.Groups.AddDef("预算下达总金额","下达文件_安排资金") '根据用户密码分组
bd1.Groups.AddDef("附件","下达文件_文件扫描件") '根据用户密码分组
Tables("预算录入窗口_Table1").DataSource = bd1.BuildDataSource()
Tables("预算录入窗口_table1").AutoSizeCols() '设置自动列宽
End If
DataTables("预算录入主表").LoadFilter = ""
DataTables("预算录入主表").Load(False)
For Each dr As DataRow In DataTables("预算录入主表").Select("[记录编号] = '"& lst.Table.Current("记录编号") &"'")
dr("资金来源") = lst.Table.Current("预算安排_资金来源")
dr("下达年度") = lst.Table.Current("预算安排_年度")
dr("预算下达部门") = lst.Table.Current("预算安排_下达部门")
dr("预算资金性质") = lst.Table.Current("预算安排_资金性质")
dr("文件编号") = lst.Table.Current("下达文件_文件编号")
dr("文件标题") = lst.Table.Current("下达文件_文件内容")
dr("预算下达总金额") = lst.Table.Current("下达文件_安排资金")
dr("附件") = lst.Table.Current("下达文件_文件扫描件")
Tables("预算录入明细表").AutoSizeCols() '设置自动列宽
Next
e.Form.Close()
End If
列名ysjehj,wjsmj无效,一个是高精度小数,一个是FileManager文件管理里面的文件,需要保存到数据表里,不知道格式是不是错了