Dim sql11 As String
sql11 = "SELECT * FROM stock where expiration_date < " & Date.Today
da2 = New OleDbDataAdapter(sql11, conn)
da2.Fill(ds2, "tb_emp")
Dim row_c As Integer
row_c = ds2.Tables(0).Rows.Count
If row_c > 0 Then
dc.CommandType = CommandType.Text
dc.CommandText = sql11
dc.Connection = conn
dr = dc.ExecuteReader
dr.Read()
id_ex = dr("expiration_date")
MessageBox.Show("หมดอายุ")
Else
MessageBox.Show("noooo")
End If
End Sub
Dim sql11 As String
Dim i As Integer
sql11 = "SELECT * FROM stock where expiration_date < '" & Date.Today &"'"
con.open
cm = New Sqlcommand(sql11,con)
i = cm.Executescalar
If i > 0 Then
MessageBox.Show("หมดอายุแล้วครับ")
Else
MessageBox.Show("ยังไม่หมดอายุครับ")
End If
End Sub