Monday, March 19, 2012

Data Convertion error help

Hi,

I have an error:"*erro while update quantity. Error converting data type nvarchar to int "while i try update data through form page. Does anybody have any idea how can i correct the error??

I didnt try two methods but both given same error and failed update: -

1) Dim sqlcomm As New SqlCommand(sSaveQuote, rConnect)
....

sqlcomm.Parameters.AddWithValue("@.employeeID", sUserID)
sqlcomm.Parameters.AddWithValue("@.quantity", txtquantity.Text)

2)Error converting data type nvarchar to int ??
Dim rConnect As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("CRNS_CustomerConnectionString").ConnectionString)
Dim command As SqlCommand = New SqlCommand("UpdateOrder", rConnect)
command.CommandType = Data.CommandType.StoredProcedure

If OrderInfo.Verified.ToUpper = "True" Or OrderInfo.Verified = 1 Then

command.Parameters.Add("@.Verified", Data.SqlDbType.Bit)
command.Parameters("@.Verified").Value = 1
Else
command.Parameters.Add("@.Verified", Data.SqlDbType.Bit)
command.Parameters("@.Verified").Value = 0
End If

command.Parameters.Add("@.Comment", Data.SqlDbType.VarChar, 100)
command.Parameters("@.Comment").Value = OrderInfo.Comment

command.Parameters.Add("@.ProductID", Data.SqlDbType.Int)
command.Parameters("@.ProductID").Value = OrderInfo.ProductID

command.Parameters.Add("@.OrderDate", Data.SqlDbType.SmallDateTime)
command.Parameters("@.OrderDate").Value = OrderInfo.OrderDate

Cheers:)

Christe

It seems that your column is int type and what you try to send in connot convert to int.|||

Hi,

Thks for kind replied. Do you have any idea or hint, how can i correct the error?? or how i can convert the nvarchar to int before update in dbs??

cheers:)

|||

Hi

You could debug your program to see if the value you pass to parameter is right ,especiallyOrderInfo.ProductID.

No comments:

Post a Comment