Click here to Skip to main content
15,915,873 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to install silverlight in vs 2005? Pin
Member 41949061-May-08 3:44
Member 41949061-May-08 3:44 
AnswerRe: How to install silverlight in vs 2005? Pin
eyeseetee1-May-08 4:49
eyeseetee1-May-08 4:49 
AnswerRe: How to install silverlight in vs 2005? Pin
Vasudevan Deepak Kumar1-May-08 21:20
Vasudevan Deepak Kumar1-May-08 21:20 
Question[AJAX] Updating Repeater Control Pin
gargagan1-May-08 2:04
gargagan1-May-08 2:04 
QuestionRe: [AJAX] Updating Repeater Control Pin
Abhijit Jana1-May-08 3:36
professionalAbhijit Jana1-May-08 3:36 
AnswerRe: [AJAX] Updating Repeater Control Pin
Christian Graus1-May-08 3:37
protectorChristian Graus1-May-08 3:37 
AnswerRe: [AJAX] Updating Repeater Control Pin
Christian Graus1-May-08 3:36
protectorChristian Graus1-May-08 3:36 
Questionsearching problem Pin
Miss Maheshwari1-May-08 1:21
Miss Maheshwari1-May-08 1:21 
AnswerRe: searching problem Pin
eyeseetee1-May-08 1:32
eyeseetee1-May-08 1:32 
GeneralRe: searching problem Pin
Miss Maheshwari1-May-08 1:51
Miss Maheshwari1-May-08 1:51 
GeneralRe: searching problem Pin
eyeseetee1-May-08 2:28
eyeseetee1-May-08 2:28 
AnswerRe: searching problem Pin
Vasudevan Deepak Kumar1-May-08 21:21
Vasudevan Deepak Kumar1-May-08 21:21 
QuestionDecimals passing problem. Pin
macca241-May-08 1:21
macca241-May-08 1:21 
Decimals problem.

I have a stored procedure that returns values as decimals if I run it on query analyzer. The problem I have is that when the value
is passed to my asp.net application the decimal places disappear and the values are rounded to the nearest whole number.

Here is my stored procedure:

CREATE PROCEDURE sproc_GetTown

(
@Town varchar(100),
@TdPermUnits As int OUTPUT,
@TdHHUnits As int OUTPUT,
@TdHH Decimal(9,2) OUTPUT,
@TdPerm Decimal(9,2) OUTPUT,
@TdTotal int OUTPUT
)

AS

SELECT @TdPermUnits = TP_TOTAL, @TdHHUnits = THH_TOTAL FROM TOWN
WHERE Town = @Town

SELECT @TdTotal = @TdPermUnits + @TdHHUnits

SELECT @TdPerm = 100.00 * @TdPermUnits / @TdTotal
SELECT @TdHH = 100.00 * @TdHHUnits / @TdTotal

GO


Here is my asp.net application:


oCmd = New SqlCommand("sproc_GetTown", oConn)
oCmd.CommandType = Data.CommandType.StoredProcedure

oParam = oCmd.Parameters.Add("@Town", Data.SqlDbType.VarChar, 100)
oParam.Direction = Data.ParameterDirection.Input
oParam.Value = Townland
oParam = oCmd.Parameters.Add("@TdHH", Data.SqlDbType.Decimal, 9, 2)
oParam.Direction = Data.ParameterDirection.Output
oParam = oCmd.Parameters.Add("@TdPerm", Data.SqlDbType.Decimal, 9, 2)
oParam.Direction = Data.ParameterDirection.Output
oParam = oCmd.Parameters.Add("@TdHHUnits", Data.SqlDbType.Int, 4)
oParam.Direction = Data.ParameterDirection.Output
oParam = oCmd.Parameters.Add("@TdPermUnits", Data.SqlDbType.Int, 4)
oParam.Direction = Data.ParameterDirection.Output
oParam = oCmd.Parameters.Add("@TdTotal", Data.SqlDbType.Int, 4)
oParam.Direction = Data.ParameterDirection.Output

oConn.Open()
oCmd.ExecuteNonQuery()
oConn.Close()

Dim ldcTDHH As Decimal
ldcTDHH = oCmd.Parameters("@TdHH").Value

The value in ldcTDHH is always rounded off to the nearest whole number.

Anyone know whats wrong?
macca
AnswerRe: Decimals passing problem. Pin
eyeseetee1-May-08 1:30
eyeseetee1-May-08 1:30 
GeneralRe: Decimals passing problem. Pin
macca241-May-08 1:42
macca241-May-08 1:42 
GeneralRe: Decimals passing problem. Pin
eyeseetee1-May-08 2:27
eyeseetee1-May-08 2:27 
AnswerRe: Decimals passing problem. Pin
Guffa1-May-08 11:02
Guffa1-May-08 11:02 
AnswerRe: Decimals passing problem. Pin
Adeel Chaudhry2-May-08 2:57
Adeel Chaudhry2-May-08 2:57 
QuestionProblem with Generic Resource Files Causing a NotSupportedException Pin
Dario Solera1-May-08 0:44
Dario Solera1-May-08 0:44 
Questionsqlserver function <<top>>??? Pin
mr.mohsen1-May-08 0:01
mr.mohsen1-May-08 0:01 
AnswerRe: sqlserver function <<top>>??? Pin
eyeseetee1-May-08 0:09
eyeseetee1-May-08 0:09 
AnswerRe: sqlserver function <<top>>??? [modified] Pin
Blue_Boy1-May-08 0:16
Blue_Boy1-May-08 0:16 
AnswerRe: sqlserver function <<top>>??? Pin
R. Giskard Reventlov1-May-08 0:34
R. Giskard Reventlov1-May-08 0:34 
AnswerRe: sqlserver function <<top>>??? Pin
leckey1-May-08 2:58
leckey1-May-08 2:58 
GeneralRe: sqlserver function <<top>>??? Pin
Blue_Boy1-May-08 3:30
Blue_Boy1-May-08 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.