以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]怎么将输入的数据增加到表中 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=87616) |
-- 作者:cqusand -- 发布时间:2016/7/14 19:55:00 -- [求助]怎么将输入的数据增加到表中 代码如下: 大神给看看哪里出错了? 录入不进去 Dim gznr As String = e.Form.Controls("TextBox1").Value Dim sqr As String = e.Form.Controls("ComboBox1").Value Dim fpg As String = e.Form.Controls("ComboBox2").Value Dim cpmc As String = e.Form.Controls("ComboBox3").Value Dim cpxh As String = e.Form.Controls("ComboBox4").Value Dim gzlx As String = e.Form.Controls("ComboBox5").Value Dim cfqy As String = e.Form.Controls("ComboBox6").Value Dim pbx As WinForm.PictureBox Dim kssj As WinForm.DateTimePicker kssj = e.Form.Controls("DateTimePicker2") Dim jzsj As WinForm.DateTimePicker jzsj = e.Form.Controls("DateTimePicker1") Dim d As Date = Date.Today() Dim dr1 As DataRow If gznr = "" Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请输入工作内容,不能为空!" ElseIf sqr = "" Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请输入申请人,不能为空!" ElseIf fpg = "" Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请输入分配给,不能为空!" ElseIf gzlx = "" Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请输入工作类型,不能为空!" ElseIf cfqy = "" Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请输入存放区域,不能为空!" ElseIf kssj Is Nothing Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请选择开始时间,不能为空!" ElseIf jzsj Is Nothing Then pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\32 (48).png") e.Form.Controls("信息提示").Text = "请选择截止时间,不能为空!" dr1 = DataTables("任务信息").AddNew() dr1("工作内容") = gznr dr1("产品名称") = cpmc dr1("申请人") = sqr dr1("分配给") = fpg dr1("产品型号") = cpxh dr1("工作类型") = gzlx dr1("存放区域") = cfqy dr1("开始时间") = kssj dr1("截止时间") = jzsj DataTables.Save() e.Form.Controls("TextBox1").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 = "" pbx = e.form.Controls("PictureBox16") pbx.Image = GetImage("Images\\Clear Green Button.png") e.Form.Controls("信息提示").Text = "任务输入成功!" End If
|
-- 作者:cqusand -- 发布时间:2016/7/14 20:33:00 -- 请大神给看看 ,是代码出问题了 还是怎么回事? |
-- 作者:大红袍 -- 发布时间:2016/7/14 20:46:00 -- 每个为空的判断,里面都加一句return
下面这个写在if判断的外面
dr1 = DataTables("任务信息").AddNew() |
-- 作者:cqusand -- 发布时间:2016/7/21 21:40:00 -- 谢谢 |