This small example is based on ASP code , although i am not officially an asp fan ( php mostly ) I found its extremely easy to execute a stored procedure and pass a couple parameters using ASP.
Usually I would prefer PHP in every aspect compared to ASP , but I had to give this space to asp code. I found a couple ways of doing it , either using an ADO object which is the one used in this example , or using ASP 2.0 code. The code is: set conn = Server.CreateObject("ADODB.Connection") conn.ConnectionString = "driver={SQL Server};" & _ "server=127.0.0.1;" & _ "Address=127.0.0.1,54875;" & _ "Network=DBMSSOCN;" & _ "uid=user;" & _ "pwd=pass;" & _ "database=" & dbnamevar & ";" conn.CommandTimeout = 0 conn.Open conn.Execute "procedurename @param1='" & param1var & "' , @param2='" & param2var & "'" Response.Write("EXECUTION OF STORED PROCEDURE DONE !") conn.Close Ok , just to recap a little bit on this small snippet of code , the code that sets the connection to the MSSQL server is the one with the ABODB connection , if you watch closely it basically requires the ip address of the server , the port , the db user and the db pass , thats it. The part that executes the stored procedure is done by opening a connection and then running conn.execute The parameters passed to the stored procedure are separated by a comma Please take a close look to this: conn.CommandTimeout = 0 If you don't use that line , probably a stored procedure that takes more than a few minutes to be executed will time out, so that command tells the Ado object not to timeout ( 0 ) Felipe Fatal error: Cannot redeclare class soapclient in /home/felipecruz/public_html/comments/nusoap/nusoap.php on line 7240 |