asp fun*#@@

A

aaron

Hi,

I have program below that works fine if I hard code the values in question
but if I try to use variables I get a type mismatch.

If the line reads
Call FirstCOM.CreateUser("MyComputer","myaccount")
it works fine as long as the "MyComputer" is an actual computer.
But if I create a form, type in the two values above, call the asp file I
get a type mismatch. I printout the variables in question to make sure they
contain values and they do.

this call doesn't work where comp_name and usr_account are variables
Call FirstCOM.CreateUser(comp_name,usr_account)

<html>
<body>
<head><title>testing</title></head>
<% language = vbscript %>
<%dim comp_name
dim usr_account
dim FirstCOM
comp_name = request.form("computername")
usr_account = request.form("account")
response.write(comp_name)
%>

<P>computer: <%= comp_name %>
<P>account: <%= usr_account %>


<%Set FirstCOM = Server.CreateObject("ADSI_COM.UsrMgmt")
Call FirstCOM.CreateUser(comp_name,usr_account) '*****TYPE MISMATCH HERE
Response.write "Error " & Err.number & "<BR>"
Response.write "Done!"
%>
</body>
</html>
 
K

Ken Schaefer

Please post the exact error message you are receiving. We need to see the
error source - VBScript, or COM

Cheers
Ken

: Hi,
:
: I have program below that works fine if I hard code the values in question
: but if I try to use variables I get a type mismatch.
:
: If the line reads
: Call FirstCOM.CreateUser("MyComputer","myaccount")
: it works fine as long as the "MyComputer" is an actual computer.
: But if I create a form, type in the two values above, call the asp file I
: get a type mismatch. I printout the variables in question to make sure
they
: contain values and they do.
:
: this call doesn't work where comp_name and usr_account are variables
: Call FirstCOM.CreateUser(comp_name,usr_account)
:
: <html>
: <body>
: <head><title>testing</title></head>
: <% language = vbscript %>
: <%dim comp_name
: dim usr_account
: dim FirstCOM
: comp_name = request.form("computername")
: usr_account = request.form("account")
: response.write(comp_name)
: %>
:
: <P>computer: <%= comp_name %>
: <P>account: <%= usr_account %>
:
:
: <%Set FirstCOM = Server.CreateObject("ADSI_COM.UsrMgmt")
: Call FirstCOM.CreateUser(comp_name,usr_account) '*****TYPE MISMATCH HERE
: Response.write "Error " & Err.number & "<BR>"
: Response.write "Done!"
: %>
: </body>
: </html>
:
:
:
 
B

Bullschmidt

For debugging purposes perhaps print out the SQL statement something
like this:

'!!!
Response.Write "strSQL: " & strSQL & "<br><br>"
Response.Flush

Best regards,
J. Paul Schmidt, Freelance ASP Web Consultant
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
A

aaron

Thanks the solution was to make sure it was a string before calling the com
object.
comp_name = CStr(request.form("computername"))
usr_account = CStr(request.form("account"))

Initial error was:
Microsoft VBScript runtime error '800a000d'

Type mismatch: 'CreateUser'

/test/newuser.asp, line 18

18: Call FirstCOM.CreateUser(comp_name,usr_account)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,148
Messages
2,570,834
Members
47,380
Latest member
AlinaBlevi

Latest Threads

Top