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.
| Author |
Topic |
|
rgh3320
Starting Member
1 Post |
Posted - 2012-09-11 : 11:44:10
|
| I am completely new to SQL server i know a few of the basics. I have a VS2010 asp.net c# application with two dropdown listboxes and a textbox. I need to calculate the numbers e.g 3 + 3 = Medium, using the table below to calculate the answer so i can insert the output value into a textbox. Could anyone please help ?Regards RobTable 1 2 3 4 51 Cold Cold Cold Cold HOT2 Cold Cold Cold Medium HOT3 Cold Medium Medium HOT HOT4 Medium Medium Medium HOT HOT5 Medium Medium Medium HOT HOTDrop down Listbox 3 Drop down Listbox 3 TextBox = Medium Regards Rob |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2012-09-11 : 11:54:04
|
Create a stored procedure in your database something like shown below (I have made up column names and variable names), run the stored proc from the .net code in response to user actions, providing the selectedvalues from the list boxes to the stored proc and then display the output from the stored proc in the text boxCREATE PROCEDURE dbo.Temperature @listBox1Value INT, @listBox2Value INTAS SELECT CASE @listBox2Value WHEN 1 THEN Col2 WHEN 2 THEN Col3 WHEN 3 THEN Col4 WHEN 4 THEN Col5 END AS TextBoxText FROM YourTable WHERE @listBox1Value = Col1; GO |
 |
|
|
|
|
|