Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

how to round off inserting float values by parameter in stored procedure.

$
0
0

hi guys

 i have a parameter of float type in stored procedure, and i am sending this parameter a decimal value from code behind.

SqlParam(1).Direction = ParameterDirection.Input
                    SqlParam(1).ParameterName = "@nGradePointSelfAwareness"
                    SqlParam(1).DbType = Data.DbType.Int32
                    SqlParam(1).Value = IIf(Val(grdStudents.Rows(i).Cells("SELFAW_GP").Value) = Nothing, 0.0, Val(grdStudents.Rows(i).Cells("SELFAW_GP").Value))

\* for examples value send by this parameter  is 3.4 but when i use this value by parameter in update and insert of table through stored procedure, result is that value goes rounded off to 3 and i want this value to remain unchanged from code behind to table of database.....

here is my stored procedure............*\

@nStudentInSessionID numeric(18,0),
@nGradePointSelfAwareness float,

@nCategoryid int,

@nCampusID int,

@nUserID int,
@cSession char(10),
@dEntryDate datetime,
@dModificationDate datetime

      

AS
BEGIN
Declare @Grade varchar(10)
Declare @ReadingText varchar(max)

SEt @Grade= (Select ltrim(rtrim(cGradeCoscholastic)) from dbo.CCE_GradingSystemCoScholastic_678 Where@nGradePointSelfAwareness between nmingradepoint and nmaxgradepoint and nCategoryId=@nCategoryId )

SEt @ReadingText= isnull((Select top 1 cReading from dbo.CCC_ParameterTemplateMaster_678 Where nParameterid=4 and cGrade=@grade),'')

if exists(select * from CCE_ActivityParameterReading_678 where nstudentinsessionid=@nStudentInSessionID and nparameterid=4)
BEGIN
update dbo.CCE_ActivityParameterReading_678 set nAreaId=2, nTermId=1,nGradePoint=
@nGradePointSelfAwareness,cGrade=@Grade, cReadingText=@ReadingText, nCampusId=@nCampusID, nUserId=@nUserID, cSession=@cSession, dModificationDate=@dModificationDate where nStudentInSessionId=@nStudentInSessionID and nparameterid=4
END
ELSE
BEGIN
insert into dbo.CCE_ActivityParameterReading_678( nStudentInSessionId, nAreaId, nTermId, nParameterId, nGradePoint, cGrade, cReadingText, nCampusId, nUserId, cSession, dEnrtyDate, 
                      dModificationDate) values(@nStudentInSessionID, 2, 1,4, 
@nGradePointSelfAwareness,@Grade, @ReadingText,@nCampusID, @nUserID, @cSession, @dEntryDate, @dModificationDate)
END

PLEASE HELP ME WITH THIS... ASAP... THANK YOU.


Viewing all articles
Browse latest Browse all 21115

Trending Articles