By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,661 Members | 781 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,661 IT Pros & Developers. It's quick & easy.

Error converting varchar to numeric

P: 22
I check my database and all data types are correct
Expand|Select|Wrap|Line Numbers
  1.  conn = GetConnect()
  2.  
  3.         Dim mycommand As SqlClient.SqlCommand = New SqlClient.SqlCommand()
  4.         mycommand.Connection = conn
  5.         mycommand.CommandText = "Update Tbl_Member_Profile set F_Name='@F_Name', M_Name='@M_Name', L_Name='@L_Name', Date_Of_Birth='@Date_Of_Birth', Membership_Category='@Membership_Category', Age='@Age', F_Recruiter_Member_Code='@F_Recruiter_Member_Code', Credit_Rating='@Credit_Rating', Credit_Line='@Credit_Line', Credit_Limit='@Credit_Limit', Member_Photo_Data='@Member_Photo_Data' WHERE P_Member_Code='@P_Member_Code'"
  6.         conn.Open()
  7.  
  8.         Try
  9.  
  10.             mycommand.Parameters.Add("@F_Name", SqlDbType.VarChar).Value = txt_F_Name.Text
  11.             mycommand.Parameters.Add("@M_Name", SqlDbType.VarChar).Value = txt_M_Name.Text
  12.             mycommand.Parameters.Add("@L_Name", SqlDbType.VarChar).Value = txt_L_Name.Text
  13.             mycommand.Parameters.Add("@F_Recruiter_Member_Code", SqlDbType.Decimal).Value = TXT_rec_no.Text
  14.             mycommand.Parameters.Add("@Credit_Rating", SqlDbType.Char).Value = txt_ranking.Text
  15.             mycommand.Parameters.Add("@Membership_Category", SqlDbType.Int).Value = txt_membership.Text
  16.             mycommand.Parameters.Add("@Credit_Line", SqlDbType.Decimal).Value = txt_cre_line.Text
  17.             mycommand.Parameters.Add("@Credit_Limit", SqlDbType.Decimal).Value = txt_max_cre.Text
  18.             mycommand.Parameters.Add("@Date_Of_Birth", SqlDbType.DateTime).Value = datepicker.Value.Date
  19.             mycommand.Parameters.Add("@Age", SqlDbType.Int).Value = txt_age.Text
  20.             mycommand.Parameters.Add("@Member_Photo_Data", SqlDbType.Image).Value = imgByteArray
  21.             mycommand.Parameters.Add("@P_Member_Code", SqlDbType.Decimal).Value = txt_Cus_No.Text
  22.             mycommand.ExecuteNonQuery()
  23.             MsgBox("Success")
  24.         Catch ex As System.Data.SqlClient.SqlException
  25.             MsgBox(ex.Message)
  26.         End Try
Thanks in advance
Apr 21 '14 #1
Share this Question
Share on Google+
1 Reply


100+
P: 294
Which fields in the database are numerics? Let's start there.
Apr 24 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.