Question : sql update

IN asp.net I am updating a table . The problem is I want a field to simply increment by 1 and my code doesnt give an error but it doesnt incrmenet the smallint field by 1.
IT is the sin field.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
command.CommandText = _
         "update results set sin=@sin,cos=@cos where id=@id"
        

       
        command.Parameters.Add(New SqlParameter("@id", SqlDbType.NChar, 10))
        command.Parameters.Add(New SqlParameter("@sin", SqlDbType.SmallInt))
        command.Parameters.Add(New SqlParameter("@cos", SqlDbType.SmallInt))

     
        '

        command.Parameters("@id").Value = a
        b = command.Parameters("@sin").Value
        command.Parameters("@sin").Value = b + 1
        command.Parameters("@cos").Value = 1

Answer : sql update

Yes, retrieve the value first. I believe you can short cut that operation by just writing b = command2.ExecuteScalar().
Random Solutions  
 
programming4us programming4us