how to convert nvarchar to decimal value

Laarchie

New Member
i have created a table for educational information .one of it's field is for AverageMark and so i have set it's datatype to Decimal(2,2)-(for example marks such as: 18.21 , 20, 15.50 ,...).but i don't know whether is this datatype is correct or sould be changed ?because when i want to insert into database from Asp.net an exception always thrown which is like below:\[code\]cmd.Parameters.Add("@Average", SqlDbType.Decimal).Value = http://stackoverflow.com/questions/12669239/Convert.ToDecimal(Average.Text.Trim());\[/code\]and the exception is : Error converting data type numeric to decimal.i don't konw what to do now to insert marks with only 2 decimal value?
 
Back
Top