TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Basit Khan
NA
336
121.6k
SQL DataType Float giving/return exponationa value
Jun 23 2015 2:25 AM
I have a table called Mst_Stock the Columns are Stk_Qty dataType is Float and Stk_ItmNo DataType is Numeric.
When i wrote a below code to Deduct the Qty from Mst_Stock When i pass the Integer value then its ok, but when its decimal value then its goes to exponation.
Please help on this.
Below is the ASP.Net Code
Private Sub Frm_StockUpdate(ByVal LdbM_NewStkQty As Double, ByVal LdbM_ItemNo As Double)
Dim LdbM_TotalQty As Double
con.Open()
cmd = New SqlClient.SqlCommand("Select * from Mst_Stock Where Stk_ItmNo=" & LdbM_ItemNo & "", con)
dr = cmd.ExecuteReader()
If dr.HasRows Then
While dr.Read
If IsDBNull(dr("Stk_Qty")) = False Then
LdbM_TotalQty = dr("Stk_Qty")
LdbM_TotalQty = LdbM_TotalQty - LdbM_NewStkQty
Else
'LdbM_TotalQty = LdbM_TotalQty + LdbM_NewStkQty
End If
End While
End If
con.Close()
Dim LsM_Qryinsert2 As String
con.Open()
LsM_Qryinsert2 = "update Mst_Stock set Stk_Qty=@Stk_Qty Where Stk_ItmNo=" & LdbM_ItemNo & ""
cmd = New SqlClient.SqlCommand(LsM_Qryinsert2, con)
cmd.CommandType = CommandType.Text
cmd.Parameters.AddWithValue("Stk_Qty", LdbM_TotalQty)
cmd.ExecuteNonQuery()
con.Close()
End Sub
What problem if i use float.
Thanks Basit.
Reply
Answers (
0
)
measuring cosine similarity for multiple document n queries
c# windows appliaction & database