以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 移动端判断提示错误 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=191958) |
|
-- 作者:xuzihang -- 发布时间:2024/5/18 11:18:00 -- 移动端判断提示错误 老师,我有两个表:从第一个表里判断卡号不能重复,从第二个表里判断找出来卡号,和对应上激活码和销售人。 我现在写完不起作用。麻烦老师指点 Case "jihuo.htm" \'激活卡号 If e.PostValues.Count = 0 Then wb.AddTopTips("", "toptip1", "") \'用于显示动态错误提示 wb.AddForm("", "form1", "jihuo.htm") UserName = e.Cookies("username") OpenID = e.Cookies("openid") KHID = e.Cookies("KHID") Dim dr2 As DataRow = DataTables("会员充值").SQLFind("openid =\'" & Openid & "\'") If dr2 Is Nothing Then If e.PostValues.ContainsKey("卡号") AndAlso e.PostValues.ContainsKey("激活码") Then \'判断是否是验证失败后的重新登录 \' Dim Verified As Boolean \'用于标记用户是否通过了身份验证 Dim 卡号 As String Dim 激活码 As String 卡号 = e.PostValues("卡号") 激活码 = e.PostValues("激活码") Dim drtk As DataRow drtk = DataTables("提卡明细").SQLFind("卡号 =\'" & 卡号 & "\'") \' Dim 激活码 As String If drtk("卡号") IsNot Nothing AndAlso drtk("激活码") = DataTables("提卡明细").SQLFind("激活码 =\'" & 激活码 & "\' and 卡号 =\'" & 卡号 & "\'") Then If e.PostValues("卡号") = drtk("卡号") AndAlso e.PostValues("激活码") = drtk("激活码") Then \'DataTables("提卡明细").SQLFind("卡号 =\'" & 卡号 & "\'") Then Verified = True \'验证正确 Else wb.AddTopTips("", "toptip1", "卡号或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If End If End If With wb.AddInputGroup("form1", "ipg1", "客户资料") \'空行时候,从客户信息里引来的数据 .AddHiddenValue("openid", dr1("openid")) .AddHiddenValue("KHID", dr1("KHID")) .AddHiddenValue("nickname", dr1("nickname")) .AddInput("姓名", "姓名", "Text").value = dr1("客户名") \'前一个"姓名"是ID,后一个"姓名"是标题 .AddInput("电话", "电话", "number").value = dr1("电话") With .AddInput("地址", "地址", "Text") .value = dr1("客户住址_蓝牌地址") .PlaceHolder = "唯一地址,不可更改" End With End With With wb.AddInputGroup("form1", "ipg2", "会员类型") With .AddSelect("类别", "类别", "|" & DataTables("会员类型").GetComboListString("类别")) .Attribute = """ End With .AddSelect("会员类型", "会员类型", "") .AddHiddenValue("入会日期", Date.Today) .AddInput("年费", "售价", "Text") .AddInput("卡号", "卡号", "Text") .AddInput("激活码", "密码", "password") .AddInput("销售人", "推荐人", "Text") End With With wb.AddButtonGroup("form1", "btg1", True) .Add("btn3", "提交绑卡信息", "submit") End With e.WriteString(wb.Build) ElseIf dr2("姓名")IsNot Nothing AndAlso dr2("电话")IsNot Nothing AndAlso dr2("地址")IsNot Nothing AndAlso dr2("卡号")IsNot Nothing AndAlso dr2("销售人")IsNot Nothing AndAlso dr2("年费")IsNot Nothing Then With wb.AddInputGroup("form1", "ipg1", "客户资料") \'有值后,从记录信息里读取数据 \' .AddInput("姓名", "姓名", "Text").value = dr2("姓名") \'前一个"姓名"是ID,后一个"姓名"是标题 \' .AddInput("openid", "openid", "Text").value = dr2("openid") \' .AddInput("nickname", "昵称", "Text").value = dr2("nickname") \' .AddInput("KHID", "KHID", "Text").value = dr2("KHID") With .AddInput("电话", "电话", "number") .value = dr2("电话") .Readonly = True End With With .AddInput("地址", "地址", "Text") .value = dr2("地址") .Readonly = True End With End With With wb.AddInputGroup("form1", "ipg2", "会员详情") With .AddInput("入会日期", "日期", "Text") .value = dr2("入会日期") .Readonly = True End With .AddInput("到期日期", "到期", "Text").value = dr2("到期日期") With .AddInput("会员类型", "类型", "Text") .value = dr2("会员类型") .Readonly = True End With With .AddInput("卡号", "卡号", "Text") .value = dr2("卡号") .Readonly = True End With With .AddInput("剩余天数", "剩余天数", "Text") .value = dr2("剩余天数") .Readonly = True End With With .AddInput("消费次数", "消费次数", "Text") .value = dr2("消费次数") .Readonly = True End With With .AddInput("状态", "状态", "Text") .value = dr2("次状态") .Readonly = True End With End With With wb.AddButtonGroup("form1", "btg1", True) \' .Add("btn1", "不可修改", "submit").Kind = 1 .Add("btn2", "返回主页", "button", "default.htm") End With e.WriteString(wb.Build) End If Else Dim nms() As String = {"openid", "姓名", "电话", "入会日期", "地址", "类别", "会员类型", "卡号", "年费", "销售人", "激活码"} \'不能为空的列名数组 For Each nm As String In nms If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页 With wb.AddMsgPage("", "msgpage", "增加失败", nm & "不能为空!") .icon = "Warn" \'改变图标 .AddButton("btn1", "返回").Attribute = "" End With e.WriteString(wb.Build) Return \'必须返回 End If Next nms = New String() {"openid", "nickname", "KHID", "姓名", "电话", "入会日期", "类别", "地址", "会员类型", "卡号", "年费", "销售人"} \'重新定义了nms数组,增加了两列. Dim dr3 As DataRow = DataTables("会员充值").AddNew() For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then dr3(nm) = e.PostValues(nm) End If Next \'保存并生成增加成功提示页面 dr3.save() With wb.AddMsgPage("", "msgpage", "增加成功", "好服务") \'生成成功提示页 \' .AddButton("btn1", "继续修改", "jihuo.htm").Kind = 1 .AddButton("btn2", "返回首页", "default.htm") End With e.WriteString(wb.Build) End If |
|
-- 作者:有点蓝 -- 发布时间:2024/5/18 11:43:00 -- If e.PostValues.ContainsKey("卡号") AndAlso e.PostValues.ContainsKey("激活码") Then \'判断是否是验证失败后的重新登录 \' Dim Verified As Boolean \'用于标记用户是否通过了身份验证 Dim 卡号 As String Dim 激活码 As String 卡号 = e.PostValues("卡号") 激活码 = e.PostValues("激活码") Dim drtk As DataRow drtk = DataTables("提卡明细").SQLFind("激活码 =\'" & 激活码 & "\' and 卡号 =\'" & 卡号 & "\'") If drtk IsNot Nothing Then Verified = True \'验证正确 Else wb.AddTopTips("", "toptip1", "卡号或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If End If End If
|
|
-- 作者:xuzihang -- 发布时间:2024/5/18 12:00:00 -- 老师,按照老师的操作了,不起作用,错误的激活码也能 确认通过 没有提示的 录入的表 会员充值,验证表是 提卡明细 里的【卡号】 和【激活码】
|
|
-- 作者:有点蓝 -- 发布时间:2024/5/18 14:38:00 -- 具体是什么地方不起作用?不能接收数据?不能保存?哪里判断有问题? 这个代码具体要处理什么逻辑,使用文字完整说明一下
[此贴子已经被作者于2024/5/18 14:39:16编辑过]
|
|
-- 作者:xuzihang -- 发布时间:2024/5/18 15:12:00 -- 老师我这样写了额,也没好使 If dr2("卡号") = DataTables("会员充值").SQLFind("卡号 = \'" & 卡号 & "\'") Then \'("卡号 = \'" & e.NewValue & "\'")Then wb.AddTopTips("", "toptip1", "卡号已经存在!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示 Else Dim drtk As DataRow drtk = DataTables("提卡明细").SQLFind("激活码 =\'" & 激活码 & "\' and 卡号 =\'" & 卡号 & "\'") If drtk IsNot Nothing Then \' Verified = True \'验证正确 With wb.AddButtonGroup("form1", "btg1", True) .Add("btn3", "提交绑卡信息", "submit") End With Else wb.AddTopTips("", "toptip2", "卡号或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If End If End If |
|
-- 作者:xuzihang -- 发布时间:2024/5/18 15:55:00 --
|
|
-- 作者:有点蓝 -- 发布时间:2024/5/18 16:40:00 -- 把完整代码发上来 |
|
-- 作者:xuzihang -- 发布时间:2024/5/18 16:45:00 -- Case "jihuo.htm" \'激活卡号 If e.PostValues.Count = 0 Then \' wb.AddTopTips("", "toptip1", "") \'用于显示动态错误提示 wb.AddForm("", "form1", "jihuo.htm") UserName = e.Cookies("username") OpenID = e.Cookies("openid") KHID = e.Cookies("KHID") Dim dr2 As DataRow = DataTables("会员充值").SQLFind("openid =\'" & Openid & "\'") If dr2 Is Nothing Then With wb.AddInputGroup("form1", "ipg1", "客户资料") \'空行时候,从客户信息里引来的数据 .AddHiddenValue("openid", dr1("openid")) .AddHiddenValue("KHID", dr1("KHID")) .AddHiddenValue("nickname", dr1("nickname")) .AddInput("姓名", "姓名", "Text").value = dr1("客户名") \'前一个"姓名"是ID,后一个"姓名"是标题 .AddInput("电话", "电话", "number").value = dr1("电话") With .AddInput("地址", "地址", "Text") .value = dr1("客户住址_蓝牌地址") .PlaceHolder = "唯一地址,不可更改" End With End With With wb.AddInputGroup("form1", "ipg2", "会员类型") With .AddSelect("类别", "类别", "|" & DataTables("会员类型").GetComboListString("类别")) .Attribute = """ End With .AddSelect("会员类型", "会员类型", "") .AddHiddenValue("入会日期", Date.Today) .AddInput("年费", "售价", "Text") .AddInput("卡号", "卡号", "Text") .AddInput("激活码", "密码", "password") .AddInput("销售人", "推荐人", "Text") End With If e.PostValues.ContainsKey("卡号") AndAlso e.PostValues.ContainsKey("激活码") Then \'判断是否是验证失败后的重新登录 \' Dim Verified As Boolean \'用于标记用户是否通过了身份验证 Dim 卡号 As String Dim 激活码 As String 卡号 = e.PostValues("卡号") 激活码 = e.PostValues("激活码") If dr2("卡号") = DataTables("会员充值").SQLFind("卡号 = \'" & 卡号 & "\'") Then \'("卡号 = \'" & e.NewValue & "\'")Then wb.AddTopTips("", "toptip1", "卡号已经存在!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示 Else Dim drtk As DataRow drtk = DataTables("提卡明细").SQLFind("激活码 =\'" & 激活码 & "\' and 卡号 =\'" & 卡号 & "\'") If drtk IsNot Nothing Then \' Verified = True \'验证正确 With wb.AddButtonGroup("form1", "btg1", True) .Add("btn3", "提交绑卡信息", "submit") End With Else wb.AddTopTips("", "toptip2", "卡号或密码错误!").msec = 2000 \'如果用户通过登录按钮访问,则给用户一个2秒的提示. End If End If End If \' With wb.AddButtonGroup("form1", "btg1", True) \' .Add("btn3", "提交绑卡信息", "submit") \' End With e.WriteString(wb.Build) |
|
-- 作者:xuzihang -- 发布时间:2024/5/18 16:46:00 -- ElseIf dr2("姓名")IsNot Nothing AndAlso dr2("电话")IsNot Nothing AndAlso dr2("地址")IsNot Nothing AndAlso dr2("卡号")IsNot Nothing AndAlso dr2("销售人")IsNot Nothing AndAlso dr2("年费")IsNot Nothing Then With wb.AddInputGroup("form1", "ipg1", "客户资料") \'有值后,从记录信息里读取数据 \' .AddInput("姓名", "姓名", "Text").value = dr2("姓名") \'前一个"姓名"是ID,后一个"姓名"是标题 \' .AddInput("openid", "openid", "Text").value = dr2("openid") \' .AddInput("nickname", "昵称", "Text").value = dr2("nickname") \' .AddInput("KHID", "KHID", "Text").value = dr2("KHID") With .AddInput("电话", "电话", "number") .value = dr2("电话") .Readonly = True End With With .AddInput("地址", "地址", "Text") .value = dr2("地址") .Readonly = True End With End With With wb.AddInputGroup("form1", "ipg2", "会员详情") With .AddInput("入会日期", "日期", "Text") .value = dr2("入会日期") .Readonly = True End With .AddInput("到期日期", "到期", "Text").value = dr2("到期日期") With .AddInput("会员类型", "类型", "Text") .value = dr2("会员类型") .Readonly = True End With With .AddInput("卡号", "卡号", "Text") .value = dr2("卡号") .Readonly = True End With With .AddInput("剩余天数", "剩余天数", "Text") .value = dr2("剩余天数") .Readonly = True End With With .AddInput("消费次数", "消费次数", "Text") .value = dr2("消费次数") .Readonly = True End With With .AddInput("状态", "状态", "Text") .value = dr2("次状态") .Readonly = True End With End With With wb.AddButtonGroup("form1", "btg1", True) \' .Add("btn1", "不可修改", "submit").Kind = 1 .Add("btn2", "返回主页", "button", "http://wx.ddlai.com.cn/default.htm") End With e.WriteString(wb.Build) End If Else Dim nms() As String = {"openid", "姓名", "电话", "入会日期", "地址", "类别", "会员类型", "卡号", "年费", "销售人", "激活码"} \'不能为空的列名数组 For Each nm As String In nms If e.PostValues.ContainsKey(nm) = False Then \'生成错误提示页 With wb.AddMsgPage("", "msgpage", "增加失败", nm & "不能为空!") .icon = "Warn" \'改变图标 .AddButton("btn1", "返回").Attribute = "" End With e.WriteString(wb.Build) Return \'必须返回 End If Next nms = New String() {"openid", "nickname", "KHID", "姓名", "电话", "入会日期", "类别", "地址", "会员类型", "卡号", "年费", "销售人"} \'重新定义了nms数组,增加了两列. Dim dr3 As DataRow = DataTables("会员充值").AddNew() For Each nm As String In nms If e.PostValues.ContainsKey(nm) Then dr3(nm) = e.PostValues(nm) End If Next \'保存并生成增加成功提示页面 dr3.save() With wb.AddMsgPage("", "msgpage", "增加成功", "好运来 ") \'生成成功提示页 \' .AddButton("btn1", "继续修改", "jihuo.htm").Kind = 1 .AddButton("btn2", "返回首页", "default.htm") End With e.WriteString(wb.Build) End If
|
|
-- 作者:有点蓝 -- 发布时间:2024/5/18 16:56:00 -- 这个还不是完整代码,因为看不到dr1是怎么来的。 其次下面代码,如果"会员充值"表有和没有这个openid的数据,后续应该怎么处理?因为如果没有这个openid的数据,后面卡号的对比完全都是多余的 DataTables("会员充值").SQLFind("openid =\'" & Openid & "\'")
|