I am trying to write a program that has the user fill in a lot of information and then it uploads the data to 5 tables in an access database. I am sure that if someone could help me upload one set of records into a table then I can get the rest. Here is the code that I am trying but I keep getting an en error that says:
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
Please help if you can. Thanks in advanced.
Dim conIncident As OleDbConnection
Dim strIncident As String
Dim strComplaintant As String
Dim strSuspect As String
Dim strNarrative As String
Dim cmdIncident As OleDbCommand
Dim cmdComplaintant As OleDbCommand
Dim cmdSuspect As OleDbCommand
Dim cmdNarrative As OleDbCommand
conIncident = New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=C:\Incident.mdb"
strIncident = "Insert Into tb_IncidentTicket (pk_ReportNumber, DateOccured, TimeOccured, DateReported, TimeReported, Wats, XCoordinate, YCoordinate, CodeNumber, County, District, ReportingMethod, TypeIncident, location, GPSZone, Datum) Values ( @pk_ReportNumber, @DateOccured, @TimeOccured, @DateReported, @TimeReported, @Wats, @XCoordinate, @YCoordinate, @CodeNumber, @County, @District, @ReportingMethod, @TypeIncident, @Location, @GPSZone, @Datum)"
'
cmdIncident = New OleDbCommand(strIncident, conIncident)
cmdIncident.Parameters.Add("@pk_ReportNumber", txtReportNumber.Text)
cmdIncident.Parameters.Add("@DateOccured", txtDateOccured.Text)
cmdIncident.Parameters.Add("@TimeOccured", txtTimeOccured.Text)
cmdIncident.Parameters.Add("@DateReported", txtDateReported.Text)
cmdIncident.Parameters.Add("@TimeReported", txtTimeReported.Text)
cmdIncident.Parameters.Add("@Wats", txtWats.Text)
cmdIncident.Parameters.Add("@XCoordinate", txtXCoord.Text)
cmdIncident.Parameters.Add("@YCoordinate", txtYCoord.Text)
cmdIncident.Parameters.Add("@CodeNumber", txtCodeNumber.Text)
cmdIncident.Parameters.Add("@County", cmbCounty.Text)
cmdIncident.Parameters.Add("@District", cmbDistrict.Text)
cmdIncident.Parameters.Add("@ReportingMethod", cmbReported.Text)
cmdIncident.Parameters.Add("@TypeIncident", cmdTypeIncident.Text)
cmdIncident.Parameters.Add("@Location", txtLocation.Text)
cmdIncident.Parameters.Add("@GPSZone", txtZone.Text)
cmdIncident.Parameters.Add("@Datum", cmdDatum.Text)
conIncident.Open()
cmdIncident.ExecuteNonQuery()
conIncident.Close()