When tried to update the data I got this error
"incorrect syntax near '4' Unclosed quotation mark after the character string"
Can someone fixed this error
Public Sub Save()
Dim indate As Date = DateTimePicker1.Value.Date
If String.IsNullOrEmpty(TextBox1.Text) Or String.IsNullOrEmpty(TextBox2.Text) Then
'Show your message here
MsgBox("Please fill all Data")
Else
'Show your message here
If cek_code(TextBox1.Text) = False Then
myConnection = New SqlConnection(connectionstring)
myConnection.Open()
Dim insert As SqlCommand = New SqlCommand(" INSERT INTO Mobilization (Fen_Telephone_No,Fen_Inovoice_No,Fen_VAT_No,Date,Fen_Fax_No ,Source_of_order ,Totalamount,NBT_Value ,NBT_Amount,VAT_Value ,VAT_Amount ,Grand_total,Contract_Name,Client_Name,Moblization_Value,Moblization_Percentage) VALUES('" & TextBox3.Text & "','" & TextBox1.Text & "','" & TextBox2.Text & "','" & DateTimePicker1.Value.Date & "','" & TextBox4.Text & "','" & TextBox12.Text & "','" & TextBox11.Text & "','" & TextBox10.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "','" & TextBox7.Text & "','" & TextBox8.Text & "','" & ComboBox1.Text & "','" & ComboBox2.Text & "','" & TextBox9.Text & "','" & TextBox17.Text & "')", myConnection)
insert.ExecuteNonQuery()
insert.Cancel()
MessageBox.Show("New Contact detail is Added")
myConnection.Close()
Else
myConnection = New SqlConnection(connectionstring)
myConnection.Open()
Dim update_product As SqlCommand = New SqlCommand(" UPDATE Mobilization SET Fen_Telephone_No = '" & TextBox3.Text & "',Date = '" & DateTimePicker1.Value.Date & "',[Fen_Fax_No] = '" & TextBox4.Text & "' ,Source_of_order = '" & TextBox12.Text & "',Totalamount = '" & Val(TextBox11.Text) & "' ,NBT_Amount = '" & Val(TextBox5.Text) & "',VAT_Value = '" & Val(TextBox6.Text) & "' ,VAT_Amount = '" & Val(TextBox6.Text) & "',[Grand_total] = '" & Val(TextBox8.Text) & "',[Contract_Name] = '" & ComboBox1.Text & "',[Client_Name] = '" & ComboBox2.Text & "',[Moblization_Value] = '" & Val(TextBox17.Text) & "' ,[Moblization_Percentage] = '" & Val(TextBox9.Text) & "'' where Fen_Inovoice_No='" & TextBox1.Text & "'", myConnection)
update_product.ExecuteNonQuery()
update_product.Cancel()
MsgBox("Updated succesfully", MsgBoxStyle.Information, "Informasi")
myConnection.Close()
End If
End If
End Sub