When i try ctype or convert into integer, desimal or even sqlmoney type i get an error. Cannot convert data type nvarchar to data type money.
Can anyone help me with this Please.
Here is the code...
sqlcom = New SqlCommand("insert MeasureQuantities(MeasureQuantityName,MeasureQuantityDescrip,MeasureQuantityPrice) values(@.MeasureQuantityName,@.MeasureQuantityPrice,@.MeasureQuantityDescrip)", ocnn)
ocnn.Open()
Dim decPrice As System.Data.SqlTypes.SqlMoney
decPrice.ToDecimal()
decPrice = CType(MeasureQuantityPriceAdd.Text, System.Data.SqlTypes.SqlMoney)
sqlcom.Parameters.Add("@.MeasureQuantityName", MeasureQuantityNameAdd.Text)
sqlcom.Parameters.Add("@.MeasureQuantityPrice", decPrice) 'MeasureQuantityPriceAdd.Text, System.Data.SqlTypes.SqlMoney))
sqlcom.Parameters.Add("@.MeasureQuantityDescrip", MeasureQuantityDescripAdd.Text)
sqlcom.ExecuteNonQuery()What is the value of MeasureQuantityPriceAdd.Text? If the textbox is blank, you might be getting this error. Are you databinding the textbox on page load? If so, make sure you are checking if the page is a postback, and only populate it if the page is not a poatback.|||Thanks, the real problem was in the order of the variables in the update string.
No comments:
Post a Comment