CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Connection Calling a stored procedure

Print topic Send  topic

Author Message
tonydeleon

Posts: 5
Posted: 11/11/2011, 8:41 AM

Good Moning from Santo Domingo !!

Please I need your help , I know this is very simple. To call a Stored Procedure I just want to use the connection of the form and not to open a connection again as on the code below , the name of the connection of the form is" DBConnection1" how do I configure this ?:
Another question : Do I have to close the connection after this code ?.

Elsewhere : Do I need to close the connection after the code ?




Dim cn, cmd
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "Provider=SQLOLEDB.1;Password=????;Persist Security Info=True;User ID=?????;Initial Catalog=tonydb;Data Source=??????"
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
cmd.CommandText = "P5"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("Checkin", addate, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("Checkout", addate, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("IDHotel", adInteger,adParamInput)
cmd.Parameters.Append cmd.CreateParameter("IDTipo", adInteger,adParamInput)
cmd.Parameters.Append cmd.CreateParameter("IDPlan", adInteger,adParamInput)
cmd.Parameters.Append cmd.CreateParameter("canthabdbl", adInteger,adParamInput)
cmd.Parameters.Append cmd.CreateParameter("canthabsgl", adInteger, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("canthabtpl", adInteger,adParamInput)
cmd.Parameters.Append cmd.CreateParameter("canthabcdpl", adInteger, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("cantchd", adInteger, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("canthab", adInteger, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("Tipo", adInteger, adParamInput)
cmd.Parameters.Append cmd.CreateParameter("noches", adInteger, adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("totalhab", adInteger, adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("average", adInteger,adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("Sum", adInteger,adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("SumSGL", adInteger, adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("SumTPL", adInteger, adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("SumCUAD", adInteger,adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("SumCHD", adInteger,adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("imagen", adVarWChar, adParamOutput,50)
cmd.Parameters.Append cmd.CreateParameter("zonatxt", adVarWChar, adParamOutput,50)

cmd("Checkin") = hdinter.checkin.Value
cmd("Checkout") = hdinter.checkout.Value
cmd("IDHotel") = hdinter.IDHotel.value
cmd("IDTipo") = hdinter.IDTipo.value
cmd("IDPlan") = hdinter.IDPlan.value
cmd("canthabdbl") = hdinter.sumad.value
cmd("canthabsgl") = hdinter.suma.value
cmd("canthabtpl") = hdinter.sumat.value
cmd("canthabcdpl") = hdinter.sumac.value
cmd("cantchd") = hdinter.ninos.value
cmd("canthab") = hdinter.SUMHAB.value
cmd("Tipo") = hdinter.tipo.value


cmd.Execute

hdinter.noches.Value = cmd.Parameters("noches")
hdinter.nt1.Value = cmd.Parameters("noches")
hdinter.average.Value = cmd.Parameters("average")
hdinter.gtotal.Value = cmd.Parameters("totalhab")
hdinter.imagen.Value = cmd.Parameters("imagen")
hdinter.label5.Value = cmd.Parameters("zonatxt")
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.