Hi.
Im doing a program that connects a form to access database.
Problem: I have a button that saves all the new information entered in the text boxes I have. When I click SAVE it shows a message that "A new record has been added to the database" but when I look in the database..its not there..
PLS. HELP!
thanks in advance
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
con = New OleDb.OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\God\My Documents\Visual Studio Projects\test\HostingDB.mdb")
da = New OleDb.OleDbDataAdapter("SELECT * FROM tblContact1", con)
If inc <> -1 Then
NavigateRecords()
Dim drow As DataRow
Dim dcmdbuilder As New OleDb.OleDbCommandBuilder(da)
da.MissingSchemaAction = MissingSchemaAction.AddWithKey
da.Fill(ds, "HostingDB")
drow = ds.Tables("HostingDB").NewRow()
drow("ID") = txtCiD.Text + 1
drow("CName") = txtCName.Text
drow("PCont") = txtPCont.Text
ds.Tables("HostingDB").Rows.Add(drow)
ds.AcceptChanges()
da.Update(ds, "HostingDB")
MsgBox("New record added to the database")
End If
btnSave.DialogResult = DialogResult.OK
btnUpdate.Visible = True
btnUpdate.Enabled = True
btnNew.Visible = True
btnNew.Enabled = True
btnDel.Visible = True
btnDel.Enabled = True
btnSave.Visible = False
btnCancel.Visible = False
End Sub