执行就出错.....晕死了.
以下代码进行数据填充,如果建预先立好一个同名的非临时表
则先提示已存在同名表!!然后数据填充正常!!!
如果不预先建立,则提示出错.....是编码问题还是别的问题?不会是BUG吧?
此主题相关图片如下:001.jpg
Dim Jh1,Jh2,Jh3 As DataRow
Dim Id,Rq,Tj1,Tj2,Tj3 As String
ID = e.form.Controls("ComboBox1").value
Rq = e.form.Controls("DateTimePicker1").value
Dim Cz As DataTable = DataTables("长嘱")
Dim Lz As DataTable = DataTables("临嘱")
If ID is nothing then
MessageBox.Show("请输入患者ID!","提示")
Else
If Rq > "" then
Tj1 = "[患者ID] = '" & ID & "' and [停止_停止时间] is null"
Tj2 = "[患者ID] = '" & ID & "' and [开始_开始时间] >= '" & Rq & "' and [停止_停止时间] is not null"
Tj3 = "[患者ID] = '" & ID & "' and [开始_开始时间] = '" & Rq & "' "
Else
Tj1 = "[患者ID] = '" & ID & "'"
Tj2 = "[患者ID] = '" & ID & "'"
Tj3 = "[患者ID] = '" & ID & "'"
End if
Jh1 = Cz.Find(Tj1)
Jh2 = Cz.Find(Tj2)
Jh3 = Lz.Find(Tj3)
If Jh1 is nothing and Jh2 is nothing and Jh3 is nothing Then
MessageBox.Show("不存在此记录!","提示")
Else
Dim yrqd As New DataTableBuilder("一日清单")
yrqd.AddDef("患者ID", GetType(String),10)
yrqd.AddDef("项目", GetType(String),32)
yrqd.AddDef("规格", GetType(String),32)
yrqd.AddDef("单价", GetType(Integer))
yrqd.AddDef("数量", GetType(Integer))
yrqd.AddDef("小计", GetType(Integer))
yrqd.Build()
Dim f As New Filler
f.SourceTable = Cz
f.SourceCols = "患者ID,项目,规格,单价,数量,小计"
f.DataTable = DataTables("一日清单")
f.DataCols = "患者ID,项目,规格,单价,数量,小计"
f.Filter = Tj1
f.Fill()
f.SourceTable = Cz
f.SourceCols = "患者ID,项目,规格,单价,数量,小计"
f.DataTable = DataTables("一日清单")
f.DataCols = "患者ID,项目,规格,单价,数量,小计"
f.Filter = Tj2
f.Fill()
f.SourceTable = Lz
f.SourceCols = "患者ID,项目,规格,单价,数量,小计"
f.DataTable = DataTables("一日清单")
f.DataCols = "患者ID,项目,规格,单价,数量,小计"
f.Filter = Tj3
f.Fill()
MainTable = Tables("一日清单")
End If
End If
[此贴子已经被作者于2008-12-15 13:50:32编辑过]