Dim db = HySq-l.DataBaseFactory.CreateDatabase("T4") '
Dim username As String = e.Form.Controls("usernameT").Value
Dim password As String = e.Form.Controls("passwordT").Value
If username = "" Then
Messagebox.show("请选择用户!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return
End If
Dim Sq-l = "Selec-t * From 用户表 Where 姓名 = ? and 密码 = ?"
Dim dt As Integer = db.ExecuteNonQuery(Sql, HySql.ParameterPair.GetPair("姓名", "username"), HySql.ParameterPair.GetPair("密码", "password"))
'If dt.Rows.Count = 0 Then
' Messagebox.show("此用户不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
' Return
'End If
If dt = 0 Then
Messagebox.show("此用户不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return
End If
Dim dr As system.data.DataRow
dr = dt.Rows(0) '
If e.Form.Controls("password").text = dr("password").tostring Then '
_姓名 = username
_UFFGroup = dr("Group").tostring'
Else
Messagebox.show("密码错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
问题1:红代码,报错Rows不是Integer,怎么改?参数法是蓝代码那样?
问题2:这个登录很重要,帮处理,让它严谨,安全,防止注入?