I have an application that is supposed to take a decimal input, push into a stored procedure and return a char value for use in the application.
For some reason, all of my other stored procedures seem to be working fine, however this one particular SP is not working at all.
Originally, the input was in the form of a dropdown list, however the values in the list were incorrect.
For example: 0.975 in the SQL table would show up as 1.000 in the drop down list.
1.025 somehow became 1.050. 1.075 became 2.000
So I tossed out the drop down list in favor of a text box. I still am not receiving proper return values. Actually, I am not getting any values back at all.
Here is my code:
Application Page
<asp:Label ID="Label2" runat="server" Text="Select RZD: "></asp:Label>
<asp:TextBox ID="rzdTB" runat="server"></asp:TextBox>
<asp:Label ID="rzdFSLabel" runat="server" Text="Label"></asp:Label>
Code Behind
fileNameGenerator fNG = new fileNameGenerator();
fNG.rzd = Convert.ToDouble(rzdTB.Text);
fNG.fileGenerator();
rzdFSLabel.Text = fNG.rzdfsOUT;
Label13.Text = fNG.bcfsOUT + fNG.rzdfsOUT + fNG.anglefsOUT + fNG.powerfsOUT;
lBO.fileName = fNG.bcfsOUT + fNG.rzdfsOUT + fNG.anglefsOUT + fNG.powerfsOUT;
fileNameGenerator
//declare rzd variable - convert to double
//declare rzdSymbol as the output
c2.Parameters.AddWithValue("@rzd", SqlDbType.Float).Value =rzd;
SqlParameter rzdSymbol = new SqlParameter("@rzdSymbol", SqlDbType.VarChar);
rzdSymbol.Size = 2;
rzdSymbol.Direction = ParameterDirection.Output;
c2.Parameters.Add(rzdSymbol);
//open the connection string and execute the sproc
conn.Open();
c1.ExecuteNonQuery();
c2.ExecuteNonQuery();
c3.ExecuteNonQuery();
c4.ExecuteNonQuery();
conn.Close();
bcfsOUT = c1.Parameters["@bcFS"].Value.ToString();
//string sdfsOUT to label2
rzdfsOUT = c2.Parameters["@rzdSymbol"].Value.ToString();
Stored Procedure
ALTER PROCEDURE dbo.getRZDSymbol
(
@rzd decimal(10,5),
@rzdSymbol varchar(2) OUTPUT
)
AS
SET NOCOUNT ON
SELECT @rzdSymbol = rzdSymbol
FROM fileSymbolTable
WHERE rzd = @rzd
thank you for the help.