asp 访问MySQL数据库为何出现这样的问题 老大们都来啊 100分

gushenghua gushenghua 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
'=============================================================
'函数名称: CheckAccount
'用途: 检查帐号密码是否正确
'返回值: 帐号密码正确返回 帐号所属组("Admin","Common"),
' 错误返回字符串"ERROR"

Function CheckAccount(byval strConnString, byval strTableName, byval strAccount, byval strPassword)

Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open strConnString

Dim strSQL
Dim rs

strSQL = "select * from " & strTableName
strSQL = strSQL & " where ID = '"
strSQL = strSQL & strAccount & "' and Password = '"
strSQL = strSQL & strPassword & "'"

set rs=Server.CreateObject("ADODB.Recordset")
rs.open strSQL,objConn, 1, 1

if rs.RecordCount > 0 then
CheckAccount = rs("AccountGroup")

CheckAccount = LTrim(CheckAccount)
CheckAccount = RTrim(checkAccount)
else
CheckAccount = "ERROR"
end if

set objConn = nothing
set rs = nothing
End Function

明明有符合要求的数据, 为何 rs.RecordCount总返回-1啊
...全文
评论 3
收藏 已收藏
分享
返回顶部
gushenghua
ASP 28,401 成员 356,940 内容