Quantcast
Channel: SELECT máximo Horaf de uma coluna
Viewing all articles
Browse latest Browse all 12

SELECT máximo Horaf de uma coluna

0
0

Preciso pegar o valor maximo da coluna Horaf, tentei esse código mas dá erro

SqlCeCommand Comando2 = new SqlCeCommand();
            Comando2.Connection = Ligação;
            Comando2.Parameters.AddWithValue("@Login", NAME);
            Comando2.Parameters.AddWithValue("@Usuario", Acesso);
            Comando2.Parameters.AddWithValue("@Dia", VerDate.Text);
            Comando2.CommandText = "SELECT MAX(Horaf) FROM Plano WHERE Login LIKE @Login AND Usuario LIKE @Usuario AND Dia LIKE @Dia";
            SqlCeDataReader leitor2;

            leitor2 = Comando2.ExecuteReader();
            while (leitor2.Read())
            {
                MessageBox.Show(leitor2["Horaf"].ToString());
            }

Minha Coluna no SQLCE é assim:


Viewing all articles
Browse latest Browse all 12

Latest Images



Latest Images