Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OleDb Insert and selection Statements

Status
Not open for further replies.

scooby77

Programmer
Jun 9, 2003
9
0
0
US
I am trying to get my .net program to update to a mdb. I cant get my insert or select statments to work properly. I am sending some of the code so maybe you guys can see my problem. Thanks.
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 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, CompletedDate, TypeIncident, location, _GPSZone, Datum ) Values ( @pk_ReportNumber, @DateOccured, @TimeOccured, @DateReported, @TimeReported, @Wats, @XCoordinate, @YCoordinate, @CodeNumber, @County, @District, @ReportingMethod, @DateRecieved, @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()
 
An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top