I am trying to save items from listview to database,but whenever I try to run my code, the message "Object reference not set to an instant of an object".Here is my code..............
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
strsql = "Update tbl_tec_temp set tem_we_position = '" & TextBox8.Text & "', tem_we_company = '" & TextBox10.Text & "', tem_we_salary = '" & TextBox21.Text & "', tem_we_date = '" & DateTimePicker1.Text & "', tem_we_rl = '" & TextBox22.Text & "', tem_we_attach = '" & TextBox36.Text & "' where temp_no = '" & TextBox39.Text & "'"
Dim da As New MySqlDataAdapter(strsql, CONNECTION)
da.Fill(ds)
MessageBox.Show("Proceed to Work Experience", "Message", MessageBoxButtons.OK, MessageBoxIcon.None)
Try
Dim i, c As String
Dim a, b As String
i = ListView1.Items.Count - 1
While i >= 0
a = ListView1.Items.Item(i).Text
b = ListView1.Items.Item(i).SubItems.Item(1).Text
c = ListView1.Items.Item(i).SubItems.Item(2).Text
Dim QUERY As String
QUERY = "INSERT INTO tbl_tec_temp(tem_we_position,tem_we_company,tem_we_salary)VALUES ('" + a + "','" + b + "','" + c + "')"
End While
Catch eEndEdit As System.Exception
System.Windows.Forms.MessageBox.Show(eEndEdit.Message)
End Try