以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助,谢谢  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=127778)

--  作者:ezilu
--  发布时间:2018/11/21 22:33:00
--  求助,谢谢
Dim hzxm As String = e.Form.Controls("TextBox1").Value
Dim zyh As String = e.Form.Controls("TextBox2").Value
Dim ssfy As String = e.Form.Controls("TextBox3").Value
Dim gcys As String = e.Form.Controls("ComboBox1").Value
Dim yblx As String = e.Form.Controls("ComboBox2").Value
Dim sslx As String = e.Form.Controls("ComboBox3").Value
Dim qdys As String = e.Form.Controls("ComboBox4").Value
Dim zdys As String = e.Form.Controls("ComboBox5").Value
Dim dyzs As String = e.Form.Controls("ComboBox6").Value
Dim hsdr As String = e.Form.Controls("ComboBox7").Value
Dim hssr As String = e.Form.Controls("CheckedComboBox1").Value
Dim jsr As String = Forms("主界面").Controls("姓名").Text
jsr = jsr.Trim("登","录","账","号","[","]",":"," ")
Dim pbx As WinForm.PictureBox
Dim ssrq As WinForm.DateTimePicker
ssrq = e.Form.Controls("DateTimePicker1")
Dim dr As DataRow
Dim rdo1 As WinForm.RadioButton
Dim rdo2 As WinForm.RadioButton
rdo1 = e.Form.Controls("RadioButton1")
rdo2 = e.Form.Controls("RadioButton2")

If hzxm = "" Then
MessageBox.Show("姓名不能为空!","提示")
ElseIf zyh = "" Then
MessageBox.Show("住院号不能为空!","提示")
ElseIf sslx = "" Then
MessageBox.Show("手术类型不能为空!","提示")
Else
dr = DataTables("患者").Find("[患者姓名] = \'" & hzxm & "\' ")
dr("住院号") = zyh
dr("手术日期") = ssrq
dr("管床医师") = gcys
dr("医保类型") = yblx
dr("手术类型") = sslx
dr("全刀医师") = qdys
dr("主刀医师") = zdys
dr("第一助手") = dyzs
dr("护士单人") = hsdr
dr("护士双人") = hssr
dr("手术费用") = ssrq
If rdo1.Checked = True Then
dr("是否急诊") = True
Else
dr("是否急诊") = False
End If
dr = DataTables("患者信息").AddNew()

DataTables("患者信息").LoadFilter=" [患者姓名] = \'" & hzxm & "\'"
DataTables("患者信息").Load
DataTables.Save()
e.Form.Controls("TextBox1").Value = ""
e.Form.Controls("TextBox2").Value = ""
e.Form.Controls("TextBox3").Value = ""
e.Form.Controls("ComboBox1").Value = ""
e.Form.Controls("ComboBox2").Value = ""
e.Form.Controls("ComboBox3").Value = ""
e.Form.Controls("ComboBox4").Value = ""
e.Form.Controls("ComboBox5").Value = ""
e.Form.Controls("ComboBox6").Value = ""
e.Form.Controls("ComboBox7").Value = ""
e.Form.Controls("CheckedComboBox1").Value = ""
e.Form.Controls("DateTimePicker1").Value = ""
MessageBox.Show("提交成功!","提示")
End If


帮我看下这段代码 那里出错了?谢谢

总是提示“.NET Framework 版本:2.0.50727.8800
Foxtable 版本:2018.10.9.1
错误所在事件:窗口,审核数据,Button1,Click
详细错误信息:
未将对象引用设置到对象的实例。
[此贴子已经被作者于2018/11/21 22:37:32编辑过]

--  作者:有点甜
--  发布时间:2018/11/21 22:41:00
--  

dr = DataTables("患者").Find("[患者姓名] = \'" & hzxm & "\' ")

 

改成

 

dr = DataTables("患者").Find("[患者姓名] = \'" & hzxm & "\' ")

If dr is Nothing then dr = DataTables("患者信息").AddNew()


--  作者:ezilu
--  发布时间:2018/11/22 20:58:00
--  
大大  你帮我看下  修改下
使用了你的办法还是不能 添加数据

使用窗体添加数据 

谢谢麻烦
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:介入信息管理.rar

大大

--  作者:有点甜
--  发布时间:2018/11/22 21:34:00
--  

Dim hzxm As String = e.Form.Controls("TextBox1").Value
Dim zyh As String = e.Form.Controls("TextBox2").Value
Dim ssfy As String = e.Form.Controls("TextBox3").Value
Dim gcys As String = e.Form.Controls("ComboBox1").Value
Dim yblx As String = e.Form.Controls("ComboBox2").Value
Dim sslx As String = e.Form.Controls("ComboBox3").Value
Dim qdys As String = e.Form.Controls("ComboBox4").Value
Dim zdys As String = e.Form.Controls("ComboBox5").Value
Dim dyzs As String = e.Form.Controls("ComboBox6").Value
Dim hsdr As String = e.Form.Controls("ComboBox7").Value
Dim hssr As String = e.Form.Controls("CheckedComboBox1").Value

Dim jsr As String = user.name
jsr = jsr.Trim("登","录","账","号","[","]",":"," ")
Dim pbx As WinForm.PictureBox
Dim ssrq As WinForm.DateTimePicker
ssrq = e.Form.Controls("DateTimePicker1")
Dim dr As DataRow
Dim rdo1 As WinForm.RadioButton
Dim rdo2 As WinForm.RadioButton
rdo1 = e.Form.Controls("RadioButton1")
rdo2 = e.Form.Controls("RadioButton2")

If hzxm = "" Then
    MessageBox.Show("姓名不能为空!","提示")
ElseIf zyh = "" Then
    MessageBox.Show("住院号不能为空!","提示")
ElseIf sslx = "" Then
    MessageBox.Show("手术类型不能为空!","提示")
Else
    dr = DataTables("患者").Find("[患者姓名] = \'" & hzxm & "\' ")
   
    If dr Is Nothing Then dr = DataTables("患者信息").AddNew()
    dr("住院号") = zyh
    dr("手术日期") = ssrq
    dr("管床医师") = gcys
    dr("医保类型") = yblx
    dr("手术类型") = sslx
    dr("全刀医师") = qdys
    dr("主刀医师") = zdys
    dr("第一助手") = dyzs
    dr("护士单人") = hsdr
    dr("护士双人") = hssr
    dr("手术费用") = ssrq
    If rdo1.Checked = True Then
        dr("是否急诊") = True
    Else
        dr("是否急诊") = False
    End If
   
    DataTables("患者信息").LoadFilter=" [患者姓名] = \'" & hzxm & "\'"
    DataTables("患者信息").Load
    DataTables.Save()
    e.Form.Controls("TextBox1").Value = ""
    e.Form.Controls("TextBox2").Value = ""
    e.Form.Controls("TextBox3").Value = ""
    e.Form.Controls("ComboBox1").Value = ""
    e.Form.Controls("ComboBox2").Value = ""
    e.Form.Controls("ComboBox3").Value = ""
    e.Form.Controls("ComboBox4").Value = ""
    e.Form.Controls("ComboBox5").Value = ""
    e.Form.Controls("ComboBox6").Value = ""
    e.Form.Controls("ComboBox7").Value = ""
    e.Form.Controls("CheckedComboBox1").Value = ""
    e.Form.Controls("DateTimePicker1").Value = ""
    MessageBox.Show("提交成功!","提示")
End If


--  作者:ezilu
--  发布时间:2018/11/22 22:48:00
--  
.NET Framework 版本:2.0.50727.8784
Foxtable 版本:2018.10.9.1
错误所在事件:窗口,添加数据,Button1,Click
详细错误信息:
未将对象引用设置到对象的实例。

还是总是提示这个 
5555
大大辛苦了
好郁闷

--  作者:有点甜
--  发布时间:2018/11/22 22:53:00
--  

1、你有两个按钮啊,一个【新增数据】,一个【确认修改】,请去修改对应的按钮的代码。

 

2、加入msgbox定位出错位置 http://www.foxtable.com/webhelp/scr/1485.htm

 

 

 


--  作者:ezilu
--  发布时间:2018/11/23 0:08:00
--  
按照你的代码写的
现在可以添加了

但是总是提示

.NET Framework 版本:2.0.50727.8784
Foxtable 版本:2018.10.9.1
错误所在事件:窗口,添加数据,Button1,Click
详细错误信息:
参数“Expression”无法转换为类型“DateTimePicker”。


而且

    If rdo1.Checked = True Then
        dr("是否急诊") = True
    Else
        dr("是否急诊") = False
    End If

这个判断是错误的  添加数据无效
[此贴子已经被作者于2018/11/23 0:20:31编辑过]

--  作者:ezilu
--  发布时间:2018/11/23 0:31:00
--  
可以了 ,谢谢大大   是
    dr("手术日期") = ssrq.Value