Код запроса для самой ранней даты
I want to inquire about the nearest date and value with it by id and these are my attempts to find a solution
Что я уже пробовал:
sqlstr = "Select min(date_ex),qtt from table where ID =@id" cmd = New OleDbCommand(sqlstr, con) cmd.Parameters.Add(New OleDbParameter("@id", ad)) con.Open() Dim dr As OleDb.OleDbDataReader = cmd.ExecuteScalar() If dr.Read() Then DateTimePicker1.Value = dr.Item(0) TextBox5.Text = dr.Item(1) End If
cmd = New OleDb.OleDbCommand(String.Format("select min(date_ex),qtt from table where ID = '{0}'", ad), con) con.Open() Dim dr As OleDb.OleDbDataReader = cmd.ExecuteReader If dr.Read() Then DateTimePicker1.Value = dr.Item(0) TextBox5.Text = dr.Item(1) End If