Hello, my project does not record the date it was filled with a blank. Help me, please. Use VB 2008 e BD Access.
The project goes here:
projetovb2008_bdaccess.zip - 4shared.com - online file sharing and storage - download
The project goes here:
projetovb2008_bdaccess.zip - 4shared.com - online file sharing and storage - download
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim MyConnection As OleDbConnection
Dim sql_checkDATA As String
If DatanascimentoMaskedTextBox.Text = " / /" Then
'BancodedadosDataSet.EnforceConstraints = False
sql_checkDATA = "''" 'Já tentei como Null
Else
sql_checkDATA = "#" & DatanascimentoMaskedTextBox.Text & "#"
End If
Try
MyConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " + Application.StartupPath + "\bancodedados.mdb")
Dim Sql As String = "UPDATE cadastro SET codigo=" & CodigoTextBox.Text & ", nome='" & NomeTextBox.Text & "', salario ='" & SalarioTextBox.Text & "', datanascimento=" & sql_checkDATA & " WHERE codigo=" & CodigoTextBox.Text & ""
MyConnection.Open()
Dim MyComand As New OleDbCommand(Sql, MyConnection)
MyComand.ExecuteNonQuery()
MessageBox.Show("Gravado com sucesso!!!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
MyConnection.Close()
MyComand.Dispose()
MyConnection.Dispose()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Last edited: