我想在2008年VB.NET使用KeyPress事件,但它不工作。任何人都可以幫我弄清楚這段代碼有什麼問題嗎?此消息框不會顯示,我的數據庫中的狀態也不會顯示。該程序說,這是好的,但它不工作。無法檢測按鍵響應事件Enter鍵
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事件添加到您的文本框? –
Holy Sql注入漏洞,蝙蝠俠! –
要跟進之前的評論:_請不要使用像那樣的字符串連接來構建您的查詢。如果我把「DROP TABLE TblUser; - 」放在你的KdUserTxt盒子裏? –