.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2017.3.6.1
错误所在事件:自定义函数valid_fillout
详细错误信息:
调用的目标发生了异常。
从字符串“”到类型“Date”的转换无效。
这是页面生成代码:
Dim e As RequestEventArgs = args(0) '注册第3页,完善资料
Select Case e.Path
Case "fillout.htm"
Dim wb As New weui
wb.AddTopTips("","toptip1","") '用于显示动态错误提示
wb.AddPageTitle("","pageheader","***","**************")
wb.AddForm("","form1","fillout.htm").Attribute=""
With wb.AddInputGroup("form1","ipg1","完善资料")
'.AddInput("xm","姓名","text") '常规语法增加输入框
With .AddInputCell("ic1",0) '通过InputCell增加输入框(1表示突出显示,2表示红色警示图标)
.AddLabel("lsr","我的生日",0) '增加标签(0显示在左边)
.AddInput("isr","date",1) '增加输入框(0靠左显示,1居中显示,2靠右显示)
End With
.AddSelect("shyzk","婚姻状况","|未婚|已婚|离异|丧偶")
.AddSelect("sxl","学历","|高中及以下|中专|大专|本科|硕士|博士")
.AddSelect("ssg","身高","|150及以下|151|152|153|154|155|156|157|158|159|160|161|162|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190以上")
.AddSelect("syx","月薪","|3000元以下|3001~5000|5001~8000|8001~10000|10001以上")
.AddSelect("szs","所在省","|北京市|天津市|河北省|山西省|内蒙古自治区|辽宁省|吉林省|黑龙江省|上海市|江苏省|浙江省|安徽省|福建省|江西省|山东省|河南省|湖北省|湖南省|广东省|广西壮族自治区|海南省|重庆市|四川省|贵州省|云南省|西藏自治区|陕西省|甘肃省|青海省|宁夏回族自治区|新疆维吾尔自治区")
.AddSelect("szshi","所在市","|1|2")
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "确定","submit")
End With
End With
wb.AppendHTML("<script src='./lib/ajaxform_fillout.js'></script>") '引入脚本文件
e.WriteString(wb.Build) '生成网页
End Select
这是验证内部函数页面代码:
Dim e As RequestEventArgs = args(0) '验证页面(注册第2页)
Select Case e.Path
Case "valid_fillout.htm"
Dim wb As New weui
Dim drbianh As String
If e.PostValues.ContainsKey("drbianhao") Then
drbianh = e.Cookies("drbianhao") '为cookie传递数据
End If
Dim dr As DataRow = DataTables("会员资料").sqlFind("会员编号 = '" & drbianh & "'")
msgbox("1")
Dim shengr As Date = e.PostValues("isr") '验证生日
msgbox("2")
Dim hunyzk As String = e.PostValues("shyzk") '验证婚姻状况
Dim xuel As String = e.PostValues("sxl") '验证学历
Dim sheng As String = e.PostValues("ssg") '验证身高
Dim yuex As String = e.PostValues("syx") '验证月薪
Dim suozs As String = e.PostValues("szs") '验证所在省
Dim suozshi As String = e.PostValues("szshi") '验证所在市
msgbox("3")
Dim jtrq As Date = Date.Today '定义:今天日期,取首字母作为变量名
Dim xznf As Integer = jtrq.year '定义:现在年份,取首字母作为变量名
Dim csnf As Integer = shengr.year '定义:出生年份,取首字母作为变量名
Dim nl As Integer = xznf - csnf
If csnf = "" Then
msgbox("3-1")
e.WriteString("生日不能为空!")
Return ""
ElseIf nl < 18 Then
msgbox("3-2")
e.WriteString("年龄小于18岁,不能参与!")
Return ""
ElseIf nl > 100 Then
msgbox("3-3")
e.WriteString("请输入正确的生日日期!")
Return ""
ElseIf hunyzk = "" Then
e.WriteString("婚姻状况不能为空!")
Return ""
ElseIf xuel = "" Then
e.WriteString("学历不能为空!")
Return ""
ElseIf sheng = "" Then
e.WriteString("身高不能为空!")
Return ""
ElseIf yuex = "" Then
e.WriteString("月薪不能为空!")
Return ""
ElseIf suozs = "" Then
e.WriteString("所在省不能为空!")
Return ""
ElseIf suozshi = "" Then
e.WriteString("所在市不能为空!")
Return ""
End If
If dr IsNot Nothing Then
dr("我的生日") = e.PostValues("shengr")
dr("婚姻状况") = e.PostValues("hunyzk")
dr("学历") = e.PostValues("xuel")
dr("身高") = e.PostValues("sheng")
dr("月薪") = e.PostValues("yuex")
dr("所在省") = e.PostValues("suozs")
dr("所在市") = e.PostValues("suozshi")
msgbox("4")
dr.save()
Else
msgbox("5")
End If
'With wb.AddMsgPage("","msgpage","注册成功", "本地自助服务,为您婚恋交友之路保驾护航") '生成成功提示页
'.AddButton("btn1","完善资料","/fillout.htm")
'End With
wb.InsertHTML("<meta http-equiv='Refresh' c>") '那么直接跳转到登录页面
e.WriteString(wb.Build) '生成网页
End Select