Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute stored procedure

Status
Not open for further replies.

vbajock

Programmer
Jun 8, 2001
1,921
US
Trying to do something simple here, not working - I have added a command button to a data access page,and I want to execute a stored procedure when the button is clicked. Here is my code:

<SCRIPT language=vbscript event=onclick for=cmdAddAll>
<!--

constr=cnDBConn.Open "Driver={SQL Server};Server=SQL2;Uid=XXXXXX;Pwd=YYYYY;Database=WEBGUY;"

Set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cn.Open constr
Set cmd.ActiveConnection = cn
cmd.CommandText = "dbo.DXP_WEB_USERS_updateAllLinks"
cmd.CommandType = adCmdStoredProc
' Ask the server about the parameters for the stored proc

cmd.Execute

-->
</SCRIPT>

The error I get is "SERVER: object required". The other programmer I am working with says you simply can't do this from an .htm page and I should rename it to .asp. Is he right? Is my code correct?

Thanks!


 
.htm is client side scripting so assuming your SP in on the server, you will need an ASP page to perform that.

Paul

 
The odd thing is that when I rename the page to .ASP, I get the same error

?????
 
I didn't think you would just be able to rename your code. Generally, you have to adjust some syntax. Can you post the code as you tried it on your .asp page.


Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top