Type mismatch?

Type mismatch?

am 27.09.2007 02:01:36 von zz12

Hello, would anyone tell me what's wrong with the following or if there's a
better way/practice in trying to get the current windows authenticated user
and seeing if it exists in a sql2k user table?:


Dim conn, rsAdminCheck
Set conn= CreateObject("ADODB.Connection")
Set rsAdminCheck = CreateObject("ADODB.Recordset")
conn.Open db
Set rsAdminCheck= conn.Execute("exec uspAdminCheck '" &
Request.ServerVariables("AUTH_USER") & "'")
If rsAdminCheck(0) = 1 Then '1=Yes 0=No
response.write "Yes, this user is an admin"
Else
response.write "No, this user is not an admin"
End If


It gives me the following error:

Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: "DomainName\TestUserName"]'


Thanks in advance.

Re: Type mismatch?

am 27.09.2007 06:54:28 von Adrienne Boswell

Gazing into my crystal ball I observed "zz12"
writing in
news:ObGLPmJAIHA.536@TK2MSFTNGP06.phx.gbl:

> Hello, would anyone tell me what's wrong with the following or if
> there's a better way/practice in trying to get the current windows
> authenticated user and seeing if it exists in a sql2k user table?:
>
>
> Dim conn, rsAdminCheck
> Set conn= CreateObject("ADODB.Connection")
> Set rsAdminCheck = CreateObject("ADODB.Recordset")
> conn.Open db
> Set rsAdminCheck= conn.Execute("exec uspAdminCheck '" &
> Request.ServerVariables("AUTH_USER") & "'")
> If rsAdminCheck(0) = 1 Then '1=Yes 0=No
> response.write "Yes, this user is an admin"
> Else
> response.write "No, this user is not an admin"
> End If
>
>
> It gives me the following error:
>
> Microsoft VBScript runtime (0x800A000D)
> Type mismatch: '[string: "DomainName\TestUserName"]'
>
>
> Thanks in advance.
>
>
>

What does upsadmincheck look like? What happens if you run the query in
QA?


--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Re: Type mismatch?

am 27.09.2007 16:04:18 von McKirahan

"zz12" wrote in message
news:ObGLPmJAIHA.536@TK2MSFTNGP06.phx.gbl...
> Hello, would anyone tell me what's wrong with the following or if there's
a
> better way/practice in trying to get the current windows authenticated
user
> and seeing if it exists in a sql2k user table?:
>
>
> Dim conn, rsAdminCheck
> Set conn= CreateObject("ADODB.Connection")
> Set rsAdminCheck = CreateObject("ADODB.Recordset")
> conn.Open db
> Set rsAdminCheck= conn.Execute("exec uspAdminCheck '" &
> Request.ServerVariables("AUTH_USER") & "'")
> If rsAdminCheck(0) = 1 Then '1=Yes 0=No
> response.write "Yes, this user is an admin"
> Else
> response.write "No, this user is not an admin"
> End If
>
>
> It gives me the following error:
>
> Microsoft VBScript runtime (0x800A000D)
> Type mismatch: '[string: "DomainName\TestUserName"]'

Why do you "Set rsAdminCheck=" twice?

Re: Type mismatch?

am 27.09.2007 19:28:37 von zz12

Instead of getting and passing the Request.ServerVariables("AUTH_USER")
variable to sql2k I ended up doing from the backend by using and checking it
with sql2k's SUSER_SNAME() command which returns a workable recordset.

Thanks for the speedy and helpful reply anyways gentlemen. Much
appreciated.

Take cares.


"McKirahan" wrote in message
news:kcudnYW9LZfsKmbbnZ2dnUVZ_oytnZ2d@comcast.com...
> "zz12" wrote in message
> news:ObGLPmJAIHA.536@TK2MSFTNGP06.phx.gbl...
>> Hello, would anyone tell me what's wrong with the following or if there's
> a
>> better way/practice in trying to get the current windows authenticated
> user
>> and seeing if it exists in a sql2k user table?:
>>
>>
>> Dim conn, rsAdminCheck
>> Set conn= CreateObject("ADODB.Connection")
>> Set rsAdminCheck = CreateObject("ADODB.Recordset")
>> conn.Open db
>> Set rsAdminCheck= conn.Execute("exec uspAdminCheck '" &
>> Request.ServerVariables("AUTH_USER") & "'")
>> If rsAdminCheck(0) = 1 Then '1=Yes 0=No
>> response.write "Yes, this user is an admin"
>> Else
>> response.write "No, this user is not an admin"
>> End If
>>
>>
>> It gives me the following error:
>>
>> Microsoft VBScript runtime (0x800A000D)
>> Type mismatch: '[string: "DomainName\TestUserName"]'
>
> Why do you "Set rsAdminCheck=" twice?
>
>