Foxtable(狐表)用户栏目专家坐堂 → 关于Select的问题(已解决)


  共有11428人关注过本帖树形打印复制链接

主题:关于Select的问题(已解决)

帅哥哟,离线,有人找我吗?
blackzhu
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 12:30:00 [显示全部帖子]

dt = cmd.ExecuteReader
If dt.count=0 then
Messagebox.show("账号不存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
end if

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  2楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 13:14:00 [显示全部帖子]

Dim S As String = e.Form.Controls("TextBox1").Value
Dim cmd As New SQLCommand
Dim dt As datatable
cmd.C  '外部数据源名称
cmd.CommandText = "SELECT * From {送货地址} Where [客户] = '"& S &"'" 
dt = cmd.ExecuteReader()
If dt.DataRows.Count > 0 Then
Messagebox.show("已经存在数据!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Else
Messagebox.show("可以增加数据, !","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

这段代码是判断外部数据中有无数据同文本框一样的,如果有就提示有(也就是账号存在的意思),如果没有就提示没有.

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  3楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 13:17:00 [显示全部帖子]

Dim UserName As String = e.Form.Controls("账号1").Value

Dim cmd As New SQLCommand

Dim dt As datatable

cmd.C  

cmd.CommandText = "SELECT * From {xtuser} Where [用户账号] = '"& username &"'" 

dt = cmd.ExecuteReader()

If dt.DataRows.Count > 0 Then

Messagebox.show("账号已存在!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)

Else

Messagebox.show("账号不存在, !","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)

End If
[此贴子已经被作者于2011-6-15 13:17:47编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  4楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 13:19:00 [显示全部帖子]

奇怪,外部数据源名称的那一段代码怎么出不出来的.


cmd.C

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  5楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 13:19:00 [显示全部帖子]

碰到鬼了.

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  6楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 14:31:00 [显示全部帖子]

我不知道你的目的是什么:

Dim UserName As String = e.Form.Controls("账号1").Value
Dim Usermima As String = e.Form.Controls("密码1").Value
If UserName = ""  Then
    Messagebox.show("请输入用户名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
ElseIf Usermima = ""  Then
    Messagebox.show("请输入登陆密码!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
ElseIf Usermima.Length <> 6 Then
    Messagebox.show("密码长度不足6位数!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If

Dim rdo1 As WinForm.RadioButton
Dim rdo2 As WinForm.RadioButton
rdo1 = e.Form.Controls("收银台")
rdo2 = e.Form.Controls("管理台")
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
Dim dr1 As DataRow
cmd.C
cmd.CommandText = "Select * From {xtuser} Where [用户账号] = '" & UserName & "'And [用户密码] ='" & Usermima & "'"
dt = cmd.ExecuteReader()
If dt.DataRows.Count > 0 Then
    MessageBox.Show("该账号已经登陆!", "温馨提示!")
    e.Form.Close()
Else
    Messagebox.show("用户账号或密码不正确!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

这段代码的意思是只要符合账号和密码就可以登录,否则就是提示密码和账号不对.

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  7楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 15:21:00 [显示全部帖子]

Dim UserName As String = e.Form.Controls("账号1").Value
Dim Usermima As String = e.Form.Controls("密码1").Value
If UserName = ""  Then
    Messagebox.show("请输入用户名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
ElseIf Usermima = ""  Then
    Messagebox.show("请输入登陆密码!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
ElseIf Usermima.Length <> 6 Then
    Messagebox.show("密码长度不足6位数!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return
End If

Dim rdo1 As WinForm.RadioButton
Dim rdo2 As WinForm.RadioButton
rdo1 = e.Form.Controls("收银台")
rdo2 = e.Form.Controls("管理台")
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dr As DataRow
Dim dr1 As DataRow
cmd.C
cmd.CommandText = "Select * From {xtuser} Where [用户账号] = '" & UserName & "'And [用户密码] ='" & Usermima & "' And [登陆状态] = True "
dt = cmd.ExecuteReader()
If dt.DataRows.Count > 0 Then
    MessageBox.Show("该账号已经在另外登录登陆!", "温馨提示!")
    e.Form.Close()
Else
    Messagebox.show("该帐号在此终端登录!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  8楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 15:22:00 [显示全部帖子]

这个就可以判断了,但是你怎么解决登录状态的选中问题.

 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  9楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 15:55:00 [显示全部帖子]

以下是引用xiaoqiwei在2011-6-15 15:32:00的发言:

这个就是我想问的,谢谢我如果登录状态为false,就修改为true




       那句代码的意思是如果账号和密码符合登录的文本框,以及登录状态是在TRUE的状态下,提示人家已经登录了,否则你的机器登陆了.


 回到顶部
帅哥哟,离线,有人找我吗?
blackzhu
  10楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57602 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2011/6/15 16:40:00 [显示全部帖子]

所以我想问你的问题就是你怎么来处理状态的选中问题.你加入149214517群

 回到顶部
总数 11 1 2 下一页