I' sorry but i need some help, i cant find the error. I want to add a new record to the database (access 2010), but although the dataset is updated, the added information does not save do DB.
THe code bellow is the code that i run when press the confirm data, it is suposed to add the record to the data base after it finish running, but it doesnt? What am i doing wrong?
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
Dim Nom As String
Dim mat As Integer
Dim post As String
Dim ucc1 As Boolean
Dim pbispo As Boolean
Dim lingue As Boolean
Dim mot As Boolean
Dim cozi As Boolean
Dim trc As Integer
trc = 0
mot = CheckBox3.Checked
ucc1 = CheckBox4.Checked
pbispo = CheckBox5.Checked
lingue = CheckBox6.checked()
cozi = CheckBox7.Checked
Nom = Nome_militar.Text
mat = Val(Matricula_Text.Text)
post = TextBox5.Text
Try
Me.Validate()
Me.UCCESCALASDataSet.Militares.NewMilitaresRow()
Me.UCCESCALASDataSet.Militares.AddMilitaresRow(Nom, post, mat, False, cozi, ucc1, lingue, pbispo, mot, trc, False, False)
Me.MilitaresTableAdapter.Update(Me.UCCESCALASDataSet)
Me.BindingSource1.EndEdit()
MsgBox("Militar Adicionado a Escala")
GroupBox1.Enabled = False
Catch EX As Exception
MsgBox("Erro ao adicionar militar a Escala", MsgBoxStyle.Critical)
End Try
End Sub
Private Sub AdicionarMilitarAEscalaToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AdicionarMilitarAEscalaToolStripMenuItem.Click
GroupBox1.Enabled = True
BindingSource1.AllowNew = True
BindingSource1.AddNew()
End Sub