{System.Data.OleDb.OleDbException}<<<<<<<< ERROR
CONNECTION CODE
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cnn = New OleDb.OleDbConnection
cnn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=" & Application.StartupPath & "\ReservationData.mdb"
Me.RefreshData()
' DataGridView1.Hide()
End Sub
Private Sub RefreshData()
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT infoID as [Booking No], " & _
"checkcon as [Check if Confirm], DateB as [Date Booked], Occasion, DateE as [Date of Events], Time, Place, Cperson as [Contact Person], Phone as [Tell/Cell No], Package, Quote " & _
"FROM reserv ORDER BY infoID", cnn)
Dim dt As New DataTable
da.Fill(dt)
Me.DataGridView1.DataSource = dt
cnn.Close()
End Sub
add CODE....
Private Sub btnaddnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddnew.Click
Dim cmd As New OleDb.OleDbCommand
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
cmd.Connection = cnn
If Me.txtinfoID.Tag & "" = "" Then
cmd.CommandText = "INSERT INTO reserv(infoID, checkcon, DateB, Occasion, DateE, Time, Place, Cperson, Phone, Package, Quote) " & _
" VALUES(" & Me.txtinfoID.Text & "','" & Me.txtcheckcon.Text & "','" & _
Me.dtpdatebooked.Text & "','" & Me.cbboccasion.Text & "','" & _
Me.dtpdateevent.Text & "','" & Me.txttime.Text & "','" & _
Me.txtplace.Text & "','" & Me.txtcperson.Text & "','" & _
Me.txttell.Text & "','" & Me.txtpackage.Text & "','" & _
Me.txtquote.Text & "')"
cmd.ExecuteNonQuery() <<<< ERROR {System.Data.OleDb.OleDbException}
Else
cmd.CommandText = "UPDATE reserv " & _
" SET infoID=" & Me.txtinfoID.Text & _
" checkcon=" & Me.txtcheckcon.Text & "'" & _
" DateB=" & Me.dtpdatebooked.Text & "'" & _
" Occasion=" & Me.cbboccasion.Text & "'" & _
" DateE=" & Me.dtpdateevent.Text & "'" & _
" Time=" & Me.txttime.Text & "'" & _
" Place=" & Me.txtplace.Text & "'" & _
" Cperson=" & Me.txtcperson.Text & "'" & _
" Phone=" & Me.txttell.Text & "'" & _
" Package=" & Me.txtpackage.Text & "'" & _
" Quote=" & Me.txtquote.Text & "'" & _
" WHERE ID=" & Me.txtinfoID.Tag
cmd.ExecuteNonQuery()
End If
RefreshData()
Me.btnclear.PerformClick()
cnn.Close()
End Sub
CONNECTION CODE
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cnn = New OleDb.OleDbConnection
cnn.ConnectionString = "Provider=Microsoft.Jet.Oledb.4.0; Data Source=" & Application.StartupPath & "\ReservationData.mdb"
Me.RefreshData()
' DataGridView1.Hide()
End Sub
Private Sub RefreshData()
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
Dim da As New OleDb.OleDbDataAdapter("SELECT infoID as [Booking No], " & _
"checkcon as [Check if Confirm], DateB as [Date Booked], Occasion, DateE as [Date of Events], Time, Place, Cperson as [Contact Person], Phone as [Tell/Cell No], Package, Quote " & _
"FROM reserv ORDER BY infoID", cnn)
Dim dt As New DataTable
da.Fill(dt)
Me.DataGridView1.DataSource = dt
cnn.Close()
End Sub
add CODE....
Private Sub btnaddnew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnaddnew.Click
Dim cmd As New OleDb.OleDbCommand
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If
cmd.Connection = cnn
If Me.txtinfoID.Tag & "" = "" Then
cmd.CommandText = "INSERT INTO reserv(infoID, checkcon, DateB, Occasion, DateE, Time, Place, Cperson, Phone, Package, Quote) " & _
" VALUES(" & Me.txtinfoID.Text & "','" & Me.txtcheckcon.Text & "','" & _
Me.dtpdatebooked.Text & "','" & Me.cbboccasion.Text & "','" & _
Me.dtpdateevent.Text & "','" & Me.txttime.Text & "','" & _
Me.txtplace.Text & "','" & Me.txtcperson.Text & "','" & _
Me.txttell.Text & "','" & Me.txtpackage.Text & "','" & _
Me.txtquote.Text & "')"
cmd.ExecuteNonQuery() <<<< ERROR {System.Data.OleDb.OleDbException}
Else
cmd.CommandText = "UPDATE reserv " & _
" SET infoID=" & Me.txtinfoID.Text & _
" checkcon=" & Me.txtcheckcon.Text & "'" & _
" DateB=" & Me.dtpdatebooked.Text & "'" & _
" Occasion=" & Me.cbboccasion.Text & "'" & _
" DateE=" & Me.dtpdateevent.Text & "'" & _
" Time=" & Me.txttime.Text & "'" & _
" Place=" & Me.txtplace.Text & "'" & _
" Cperson=" & Me.txtcperson.Text & "'" & _
" Phone=" & Me.txttell.Text & "'" & _
" Package=" & Me.txtpackage.Text & "'" & _
" Quote=" & Me.txtquote.Text & "'" & _
" WHERE ID=" & Me.txtinfoID.Tag
cmd.ExecuteNonQuery()
End If
RefreshData()
Me.btnclear.PerformClick()
cnn.Close()
End Sub