【发布时间】:2012-09-25 16:10:02
【问题描述】:
我正在尝试在 VB.NET 2008 中使用 KeyPress 事件,但它不起作用。谁能帮我弄清楚这段代码有什么问题?此消息框不会出现,我的数据库中的我的状态也不会出现。程序说没问题,但它不工作。
If e.KeyChar = Chr(Keys.Enter) Then
tblLogin = Proses.ExecuteQuery("Select * From TblUser where kode_user = '" & KdUserTxt.Text & "'")
If tblLogin.Rows.Count = 0 Then
MessageBox.Show("Kode User Not Found!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
KdUserTxt.Focus()
Else
StatusTxt.Text = tblLogin.Rows(0).Item("status")
PswTxt.Focus()
End If
End If
【问题讨论】:
-
如何将 KeyPress 事件添加到 TextBox 中?
-
Holy Sql 注入漏洞,蝙蝠侠!
-
跟进之前的评论:请不要使用这样的字符串连接来构建您的查询。如果我在您的 KdUserTxt 框中输入类似
'DROP TABLE TblUser;--的内容会怎样? -
那我该怎么办?我是新手,请你帮忙..