I have this (I have a connection above all this not shown):
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = conn
cmd.CommandType = 1
cmd.Parameters.Append .CreateParameter("LASTNAME", 200, 1, 50, "JONES")
cmd.CommandText = "select * from employees where lastname = ?"
cmd.Prepared = True
Set rs = cmd.Execute
As soon as I execute I get:
Active Server Pages error 'ASP 0115'
Unexpected error
myasppage.asp
A trappable error (C0000005) occurred in an external object.
The script cannot continue running.
I can't see what I am doing wrong. I tried various things such as remove prepared, but it has no effect (tried trial and error commenting out various above to no avail).
Oracle if it matters.
Thanks for help.
try changing
cmd.Parameters.Append .CreateParameter("LASTNAME", 200, 1, 50, "JONES")
to
cmd.Parameters.Append cmd.CreateParameter("@lastname", 200, 1, 50, "JONES")
This is either permissions issue, or corrupted ADO drivers.
First, just to eliminate other stuff try this code for sake of debugging:
Set rs = conn.Execute("select * from employees where lastname = 'JONES'")
If you get same error, try:
- Check permissions of IUSR account over database server, or use SQL Authentication.
- Reinstall MDAC on the server to the latest version.
Also, what database? What IIS?
I highly doubt this is the issue but it's the only thing I could see. It probably just the copy and paste but there is an extra space in this line of code. between .Append .Create
`cmd.Parameters.Append .CreateParameter("LASTNAME", 200, 1, 50, "JONES")`