Jump to content

Select retorna apenas 1 Registo


Chamuanza

Recommended Posts

Um bem aja a todos

Estou confuso com esta situação.

Tenho um select por data que apenas retorna 1 registo, quando na BaseDados access tenho 6 registos com a mesma data.

DateTimePicker1.Value = #12/11/2020 10:46:26 AM#

sDataInicio ="2020/12/11"

Coluna BaseDados =2020/12/11

Estou a usar VisualStudio 2015 Community

Agradeço uma dica para resolução da situação

Resolução - Quando passei a BD para extenção mdb no access o campo data passou a texto

 

  Dim sDataInicio = Format(DateTimePicker1.Value, "Short Date")


        Dim ConnectionString As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\DespesasPessoaisHP\DespesasPessoaisHP\DespesasPessoaisFamiliares.mdb;")

        Dim Query As String = "SELECT Id,Data,Designacao,Despesa,Categoria,SubCategoria,Familiar FROM DadosActuais  Where Data = #" & sDataInicio & "#  Order By Id"


        Dim DataAdapter As New OleDbDataAdapter(Query, ConnectionString)
        Dim MyData As New DataSet
        DataAdapter.Fill(MyData, "DadosActuais")


        ' Neste caso utilizei uma datagridview para visualizar os dados
        Me.DataGridView1.DataSource = MyData.Tables("DadosActuais")



        'Conta as linhas da Grid e coloca na Label
        Label1.Text = "Este Filtro encontrou - " & Me.DataGridView1.RowCount - 1 & " Registos"

        Button2.Enabled = False

        Call ControlaGrid()

        ' Call SomarColunas()

        ConnectionString.Close()
Edited by Chamuanza
Resolvido
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.