Must Declare Scalar Variable, I couldn't display the the Items that has expired

  • Thread starter Thread starter JasonBeja
  • Start date Start date
J

JasonBeja

Guest
Dim connection As New SqlConnection("Server= DESKTOP-5GDR0Q0\BEJASQL; Database = medinventory; Integrated Security = true")
Dim D As Date = Date.Today


D.ToString("yyyy'/'dd'/'MM")
MsgBox(D)

Dim TODAY As String = D

' Dim command As New SqlCommand '("SELECT * FROM Medicine WHERE Expiration < @date", connection)







MsgBox(TODAY)





Dim adapter As New SqlDataAdapter("SELECT * FROM Medicine WHERE Expiration < DateTime.Today", connection)

command.Parameters.Add("@date", SqlDbType.DateTime).Value = D.ToString("yyyy'/'dd'/'MM")


Dim table As New DataTable()


adapter.Fill(table)

DataGridView1.DataSource = table

Continue reading...
 
Back
Top