Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i have access data base and 8 field
i cant update NUMBER datatype to this db by vb.net
error :
C#
Data type mismatch in criteria expression.


i try this code :
C#
com.CommandText = "UPDATE register SET price_reg=@price_reg,rprice_reg=@rprice_reg,ipprice_reg=@ipprice_reg,mprice_reg=@mprice_reg,totalp_reg=@totalp_reg,operatormali_reg=@operatormali_reg,noedaryaft_reg=@noedaryaft_reg,datedaryaft_reg=@datedaryaft_reg WHERE id_reg='" & Label58.Text & "' "

     com.Parameters.AddWithValue("price_reg", TextBox12.Text)
     com.Parameters.AddWithValue("rprice_reg", TextBox11.Text)
     com.Parameters.AddWithValue("ipprice_reg", TextBox13.Text)
     com.Parameters.AddWithValue("mprice_reg", TextBox14.Text)
     com.Parameters.AddWithValue("totalp_reg", TextBox15.Text)
     com.Parameters.AddWithValue("operatormali_reg", username)
     com.Parameters.AddWithValue("noedaryaft_reg", ComboBox1.Text)
     com.Parameters.AddWithValue("datedaryaft_reg", TextBox16.Text)
     com.ExecuteNonQuery()


thanks for your answers

What I have tried:

i changed my send parameter method to :
C#
com.Parameters.AddWithValue("price_reg", convert.toint32(TextBox12.Text))
Posted
Updated 23-Nov-16 7:55am

1 solution

This is the same issue as How do I update query by number datatype[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900