i have a table "Contracts", with fields CompanyNumber, MaturityDate and other fields.
i have a form in vb.net, with a textbox that should check if the entered company number exist in my db, if it does it should check whether the maturity date is bigger or less than current date.
Any one out there that knows how to go about it? Here is the code am trying with;
Private bindingSource1 As New BindingSource()
Private dataAdapter As New OleDbDataAdapter()
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mtc.mdb"
Dim selectCommand As String
Dim connection As New OleDbConnection(connectionString)
Dim current As Date = Date.Now
selectCommand = "select * from Contracts where CompanyNumber = '" & txtCnumber.Text & "'"
Dim MyCmd As New OleDbCommand(selectCommand, connection)
Dim count As Integer
count = CInt(MyCmd.ExecuteScalar())
If count = 0 Then
MsgBox("Employee new on contract, add all areas")
ElseIf count > 0 And current.Date > "MaturityDate" Then
MsgBox("Employee already has contract and it has matured,add contract info only!")
MsgBox("Employee already has contract and it has not matured yet")