-- 作者:xiaoqiwei
-- 发布时间:2011/6/5 2:24:00
-- 关于窗口查询功能访问外部数据源的问题
此主题相关图片如下:未命名.jpg

此主题相关图片如下:未命名-1.jpg

查询按钮代码如下:
Dim re As String = e.Form.Controls("内容").Value Dim dr As DataRow If re="" Then MessageBox.Show("请输入要查询的内容!", "错误提示", MessageBoxButtons.ok, MessageBoxIcon.Information) Else dr = DataTables("user").Find("[username] =\'" & re & "\' ") e.Form.Controls("TextBox2").Value=dr("username") e.Form.Controls("TextBox3").Value=dr("nl") e.Form.Controls("TextBox4").Value=dr("bumen") e.Form.Controls("TextBox5").Value=dr("zhiwei") End If
问题:如何实现当输入的要查询的内容不存在时就弹出提示“暂未查询到该用户资料!”
Dim re As String = e.Form.Controls("内容").Value Dim dr As DataRow If re="" Then MessageBox.Show("请输入要查询的内容!", "错误提示", MessageBoxButtons.ok, MessageBoxIcon.Information) Else dr = DataTables("user").Find("[username] =\'" & re & "\' ") If “输入的内容不存在" then
MessageBox.Show("暂未查询到该用户资料!", "错误提示", MessageBoxButtons.ok, MessageBoxIcon.Information) Else
e.Form.Controls("TextBox2").Value=dr("username") e.Form.Controls("TextBox3").Value=dr("nl") e.Form.Controls("TextBox4").Value=dr("bumen") e.Form.Controls("TextBox5").Value=dr("zhiwei") End If
End If
|