A1VBCode Forums

Invalid castException problem, i can't save in my db table


http://www.a1vbcode.com/vbforums/Topic31965.aspx

By wendie022 - 5/18/2013

This is my code for button Save



Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click





openConnection()

cmd.Connection = con

cmd.CommandText = "INSERT INTO Reservations Values('" & cboCustomer.SelectedValue & "','" & Route_codeTextBox.Text & "', '" & Date_ReservedDateTimePicker.Value & "','" & FlightTextBox.Text & "', '" & ClassTextBox.Text & "','" & FareTextBox.Text & "','" & txtDeparture.Text & "','" & Departure_timeTextBox.Text & "','" & txtArrivaldate.Text & "','" & cmbSource.SelectedItem & "','" & cmbDest.SelectedItem & "','" & txtArrivaldate.Text & "','" & Arrival_timeTextBox.Text & "', '" & No_of_passengersTextBox.Text & "', '" & TotalTextBox.Text & "')"

cmd.ExecuteNonQuery()

MsgBox("Data saved")

Me.ReservationsBindingSource.EndEdit()

Me.TableAdapterManager.ReservationsTableAdapter.Update(Me.OceaniaDataSet)

con.Close()











My reservation table























This my problem

















Please help urgent
By annaharris - 6/4/2013

The images that you have attached showing the issue are not visible within your thread, please attach them again or simply write down the problem that you are facing.