Kankichi
Member
Hi guys, i have a stuped problem in my opinion, here is the code
Public Class Form4
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FacturasTableAdapter.Fill(Me.GestaoDataSet.Facturas)
End Sub
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Try
Dim asd As String
FacturasBindingSource.AddNew()
Me.Validate()
Me.FacturasTableAdapter.Update(Me.GestaoDataSet.Facturas)
DataDateTimePicker.Value = Today
DataDateTimePicker.Update()
asd = DataDateTimePicker.Value
MsgBox(asd)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
Try
Me.Validate()
Me.FacturasBindingSource.EndEdit()
Me.FacturasTableAdapter.Update(Me.GestaoDataSet.Facturas)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
I run the Aplication, when i click Add new, my DateTimePikcer already fill the date of Today(), i fill the others text boxes and save, and evrythink is fine.
But if i try to add another record it does the same thing fill DateTimePicker i fill other Text Boxes but gives me an Error that DateTimePicker is NULL even if i End The aplication i can not add more records in that SQL Table.
"Cannot insert the value NULL into column 'data', table 'C:\PROGRAMAS\MICROSOFT SQL SERVER\MSSQL.1\MSSQL\DATA\GESTAO.MDF.dbo.Facturas'; column does not allow nulls. INSERT fails.
The statement has been terminated."
If i delete the Line from Form4_Load that fill the textboxes
"Me.FacturasTableAdapter.Fill(Me.GestaoDataSet.Facturas)", i can save the record but only once, if i want to save another record i need to End Aplication and Run it again or it gives me the same Error, is stuped, i do not know what to do. I searched on Internet but i didn't find nothing.
Public Class Form4
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.FacturasTableAdapter.Fill(Me.GestaoDataSet.Facturas)
End Sub
Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
Try
Dim asd As String
FacturasBindingSource.AddNew()
Me.Validate()
Me.FacturasTableAdapter.Update(Me.GestaoDataSet.Facturas)
DataDateTimePicker.Value = Today
DataDateTimePicker.Update()
asd = DataDateTimePicker.Value
MsgBox(asd)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
Try
Me.Validate()
Me.FacturasBindingSource.EndEdit()
Me.FacturasTableAdapter.Update(Me.GestaoDataSet.Facturas)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
I run the Aplication, when i click Add new, my DateTimePikcer already fill the date of Today(), i fill the others text boxes and save, and evrythink is fine.
But if i try to add another record it does the same thing fill DateTimePicker i fill other Text Boxes but gives me an Error that DateTimePicker is NULL even if i End The aplication i can not add more records in that SQL Table.
"Cannot insert the value NULL into column 'data', table 'C:\PROGRAMAS\MICROSOFT SQL SERVER\MSSQL.1\MSSQL\DATA\GESTAO.MDF.dbo.Facturas'; column does not allow nulls. INSERT fails.
The statement has been terminated."
If i delete the Line from Form4_Load that fill the textboxes
"Me.FacturasTableAdapter.Fill(Me.GestaoDataSet.Facturas)", i can save the record but only once, if i want to save another record i need to End Aplication and Run it again or it gives me the same Error, is stuped, i do not know what to do. I searched on Internet but i didn't find nothing.