Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 List Box To Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-30 : 09:29:03
Clay Dempsey writes "I have a form with two list boxes on it. One list box is populated with values from a view. The user is allowed to make multiple selections from this list box. How this works is the user selects the value clicks the add button, remove to remove from the user selections list box. Hence, one list box to display and one that stores the selcetions that the user makes. OK, with me to this point? When the form is submitted the values need to be passed to a Stored Procedure that looks like this:


set cmdFSTwo = Server.CreateObject("ADODB.Command")
cmdFSTwo.ActiveConnection = MM_connPSR_STRING
cmdFSTwo.CommandText = "dbo.spSav_FallEvent_UserMedications"
cmdFSTwo.CommandType = 4
cmdFSTwo.CommandTimeout = 0
cmdFSTwo.Prepared = true
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@RETURN_VALUE", 3, 4)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@UEID", 3, 1,4,UEID)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode01", 3, 1,4,MedicinetypeCode01)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode02", 3, 1,4,MedicinetypeCode02)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode03", 3, 1,4,MedicinetypeCode03)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode04", 3, 1,4,MedicinetypeCode04)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode05", 3, 1,4,MedicinetypeCode05)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode06", 3, 1,4,MedicinetypeCode06)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode07", 3, 1,4,MedicinetypeCode07)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode08", 3, 1,4,MedicinetypeCode08)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode09", 3, 1,4,MedicinetypeCode09)
cmdFSTwo.Parameters.Append cmdFSTwo.CreateParameter("@MedicinetypeCode10", 3, 1,4,MedicinetypeCode10)
cmdFSTwo.Execute()


As you can see it takes all selected items and instead of a string, it separates each one. I did not write the Stored Procedure, so I have to figure out a way for the code to work. To me, passing these values as a single string would have worked, but it is too late for that now. Any suggestions?"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-11-30 : 15:13:55
What's the question? And if this is still in development, why is it too late to change how it's done?

What you have shown us is not a stored procedure, but rather, the ASP Code used to populate parameters and execute a stored procedure. So, what code do you have to figure out? Are you asking us how to write the stored procedure that gets input from this ASP code? Are you asking us how to populate the MedicientypeCodeXX variables in your ASP code? (If so, you really should visit an ASP site such as [url]http://www.4guysfromrolla.com/[/url] or [url]http://www.asp101.com/[/url].

-------------------
It's a SQL thing...
Go to Top of Page
   

- Advertisement -