以文本方式查看主题
- Foxtable(狐表) (http://foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2)
---- [求助]窗口中的Label绑定数据表的列,隐藏时值传递不到自定义函数中 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=92227)
|
-- 作者:ajie5211
-- 发布时间:2016/10/29 11:40:00
-- [求助]窗口中的Label绑定数据表的列,隐藏时值传递不到自定义函数中
窗口中的Label绑定数据表的列,隐藏时的值传递不到自定义函数中,提示“”无法转换成int整数,label不隐藏时正常,这个如何解决?
此主题相关图片如下:qq截图20161029113842.png

此主题相关图片如下:qq图片20161029113755.jpg

|
-- 作者:ajie5211
-- 发布时间:2016/10/29 11:42:00
--
我的代码是
Dim oid As Integer = e.Form.Controls("OperID").text Dim did As Integer = e.Form.Controls("DeptID").text If Functions.Execute("scShouQuan",MainTable.Name,oid,did) Dim Result As DialogResult Result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) Else Return End If Else MessageBox.show("没有删除权限!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If
|
-- 作者:有点蓝
-- 发布时间:2016/10/29 11:42:00
--
跟隐藏不隐藏应该没有关系
提示中的按钮完整代码看看
|
-- 作者:ajie5211
-- 发布时间:2016/10/29 11:48:00
--
我的自定义函数代码如下
For Each dr As DataRow In DataTables("FTtabQX").SQLSelect("表名 = \'" & args(0) & "\' and S可删除 = 1") If dr("S数据填报者") = 1 Then Return True Else If dr("S数据填报者") = 2 Then If _OperID = args(1) Then Return True End If Else If dr("S数据填报者") = 3 Then Dim val As String Dim cmd As New SQLCommand cmd.C cmd.CommandText = "Select F4747 Fro m {tabDIYTable751} Where F4752 = \'" & args(2) & "\'" val = cmd.ExecuteScalar() For Each bmjs As String In _UserRGroups Dim bm() As String = bmjs.Split(".") If bm(0) = val Then Return True End If Next Else Return False End If Next
|
-- 作者:ajie5211
-- 发布时间:2016/10/29 11:51:00
--
出错按钮的完整代码如下
Dim oid As Integer = e.Form.Controls("OperID").text Dim did As Integer = e.Form.Controls("DeptID").text If Functions.Execute("scShouQuan",MainTable.Name,oid,did) Dim Result As DialogResult Result = MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) If Result = DialogResult.Yes Then Try Connections("wjexcel").BeginTransaction() \'开始事务 Dim cmd As new SQLCommand cmd.C cmd.CommandText = "Delete Fro m {tabDIYTable281} Where [ID] = " & CInt(e.Form.Controls("ID").text) cmd.ExecuteNonQuery cmd.CommandText = "Delete Fro m {tabDIYTable282} Where [ID] = " & CInt(e.Form.Controls("ID").text) cmd.ExecuteNonQuery Connections("wjexcel").Commit \'提交事务,所有操作生效 Catch ex As Exception \'如果出错 Connections("wjexcel").Rollback() \'回滚事务,撤销所有操作 End Try \'************刷新*********** Dim cxbn As WinForm.Button = e.Form.Controls("撤销") cxbn.PerformClick() Else Return End If Else MessageBox.show("没有删除权限!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information) End If
|
-- 作者:有点蓝
-- 发布时间:2016/10/29 12:02:00
--
_OperID、列F4752 都是什么数据类型?
CInt(e.Form.Controls("ID").text) ‘控件是不是没有值,没有值就会有这个错误
|
-- 作者:ajie5211
-- 发布时间:2016/10/29 13:13:00
--
以下是引用有点蓝在2016/10/29 12:02:00的发言: _OperID、列F4752 都是什么数据类型?
CInt(e.Form.Controls("ID").text) ‘控件是不是没有值,没有值就会有这个错误
_OperID和列F4752 都是整数型,e.Form.Controls("ID").text值对应见下图。这三个label不隐藏时,是不会报错的,只有隐藏时报错。
此主题相关图片如下:qq图片20161029130958.png

[此贴子已经被作者于2016/10/29 13:12:58编辑过]
|
-- 作者:有点蓝
-- 发布时间:2016/10/29 14:41:00
--
MessageBox.Show(e.Form.Controls("OperID").text) MessageBox.Show(e.Form.Controls("DeptID").text) MessageBox.Show(e.Form.Controls("ID").text)
弹出看看有没有值
|
-- 作者:ajie5211
-- 发布时间:2016/10/29 15:07:00
--
以下是引用有点蓝在2016/10/29 14:41:00的发言:
MessageBox.Show(e.Form.Controls("OperID").text)
MessageBox.Show(e.Form.Controls("DeptID").text)
MessageBox.Show(e.Form.Controls("ID").text)
弹出看看有没有值
我用的代码如下
MessageBox.Show("OperID = \'" & e.Form.Controls("OperID").text & "\' and DeptID = \'" & e.Form.Controls("DeptID").text & "\' and ID = \'" & e.Form.Controls("ID").text & "\'")
隐藏与未隐藏的弹窗见图片
此主题相关图片如下:qq截图20161029150511.png

此主题相关图片如下:qq截图20161029150549.png

|
-- 作者:有点蓝
-- 发布时间:2016/10/29 15:14:00
--
DeptID没有值,应该是赋值的代码有问题。控件不会因为隐藏而丢失值
|