Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    vb net le date invertite incasinate....help

    Prima di tutto ciao a tutti
    ho un problema che mi turba molto
    ho un database e devo selezionare dei campi da una tabella ponendo come condizione di selezione la data .

    Private Sub DateTimePicker1_ValueChanged()
    Dim dataevent As Date
    dataevent = DateTimePicker1.Value.Date
    objConn.Open()
    strsql = ("select[utente],negozio,tipo,quantitativo,prezzototale,motivazion e,ID from acquisti where DATA=#" & dataevent & "# ")

    Dim objCommand As New OleDbCommand(strsql, objConn)
    areader = objCommand.ExecuteReader()

    End Sub
    il problema è che se gli dico di selezionarmi i dati con data 22/11/2005 tutto va bene ma se gli dico di selezionarmi i dati con data 5/3/2005 nn va affatto e ho scoperto che per selezionare i campi con data 5/3/2005 devo inserire come data di imput 3/5/2005
    Tutto cio mi turba e mi fa sudare freddo e caldo.come devo fare?help binos

  2. #2

    ARTIGIANALISSIMO MA FUNZIONANTISSIMO

    strsql = ("select [utente],negozio,tipo,quantitativo,prezzototale,motivazion e,ID from acquisti where year(DATA)=" & dataevent.Year & " and day(DATA)=" & dataevent.Day & " and month(DATA)=" & dataevent.Month & " ")
    Dim objCommand As New OleDbCommand(strsql, objConn)
    areader = objCommand.ExecuteReader()

  3. #3
    Utente bannato
    Registrato dal
    Jan 2005
    Messaggi
    9

    Re: ARTIGIANALISSIMO MA FUNZIONANTISSIMO

    Originariamente inviato da binos1979
    strsql = ("select [utente],negozio,tipo,quantitativo,prezzototale,motivazion e,ID from acquisti where year(DATA)=" & dataevent.Year & " and day(DATA)=" & dataevent.Day & " and month(DATA)=" & dataevent.Month & " ")
    Dim objCommand As New OleDbCommand(strsql, objConn)
    areader = objCommand.ExecuteReader()
    ù

    questo tip è utile se utilizzi access

    se devi fare una select in un campo data fai cosi'

    strsql="select * from tabella where campodata=cdate('" & data & "')" in access funziona bene in quanto la funzione cdate ti converte in un formato compatibile con access la data che gli stai passando

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.