尝试从数据库中获取值并设置为变量,如下所示:
Dim prefferedAgencieUser
Dim agenciePermission
sSql = "SELECT ag.UserTeamLeader "
sSQL = sSQL & " FROM dbo.BigAgencies ag "
sSQL = sSQL & " inner join TCL01_cliente cl on cl.preferred_agency=ag.id "
sSQL = sSQL & " where cl.Cod_cliente = '" & nCodCliente & "'"
Set prefferedAgencieUser = oSelect.ExecuteQuery(sSql)
if prefferedAgencieUser = UserName then
agenciePermission = 1
end if
与数据库的连接运行良好,但出现如下错误:
Microsoft VBScript runtime error '800a000d'
Type mismatch
我做错了什么?