Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have 1 form in which 1 have 9 columns. after my update query, when the tableadpater query is executing,its showing error.
Posted
Comments
sudeshna from bangkok 12-Jul-13 1:15am    
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As New SqlConnection("Data Source=.\INSTANCE;initial catalog=record;user=sa;password=gariahat")
Dim da As New SqlDataAdapter
Dim cmd As New SqlCommand
Dim ds As New DataSet
'Dim dr As SqlDataReader

cmd.Connection = cn
cn.Open()
cmd.CommandText = "Update finalsort set " & "name = '" & TextBox1.Text & "', " & "type='" & TextBox2.Text & " '," & "shape='" & TextBox3.Text & " '," & "size='" & TextBox4.Text & " ' ," & "place='" & TextBox5.Text & " '," & "weight = '" & TextBox6.Text & "', " & "issue_dt = '" & Format(CDate(TextBox7.Text), "MM/dd/yyyy") & "'," & "return_dt = '" & Format(CDate(DateTimePicker1.Value), "MM/dd/yyyy") & "'" & "Where lot_no = '" & ComboBox1.SelectedItem & "'"
cmd.ExecuteNonQuery()
MsgBox("Data successfully updated", MsgBoxStyle.Information)
Me.FinalsortTableAdapter.Insert(ComboBox1.Text, TextBox1.Text, TextBox2.Text, TextBox3.Text, Double.Parse(TextBox4.Text), TextBox5.Text, TextBox6.Text, TextBox7.Text, DateTimePicker1.Value) // showing error in this line saying that string 2.5x3.5 cant be converted to double
Me.FinalsortTableAdapter.Fill(Me.RecordDataSet.finalsort)
Me.ComboBox1.Text = ""
Me.TextBox1.Text = ""
Me.TextBox2.Text = ""
Me.TextBox3.Text = ""
Me.TextBox4.Text = ""
Me.TextBox5.Text = ""
Me.TextBox6.Text = ""
Me.TextBox7.Text = ""
Me.DateTimePicker1.Text = ""
cn.Close()
End Sub
sudeshna from bangkok 12-Jul-13 1:16am    
can anyone please help me.

thanks in advance

1 solution

try by removing ' single quotes around

size='" & TextBox4.Text & " '

then let me know if you find any errors... :)
 
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