Re: TADOQuery and Date fields problem
- From: "Shannon Walker" <shannon.walker@xxxxxxxxxx>
- Date: Thu, 16 Jun 2005 12:01:47 -0400
Thanks guys, this does work!
"Vitali Kalinin" <vitkalinin@xxxxxxxxx> wrote in message
news:42b19f7b$1@xxxxxxxxxxxxxxxxxxxxxxxxx
> This should work:
> qryLookUp.SQL.Clear;
> qryLookUp.SQL.Add('SELECT * FROM table1 WHERE (DevID = :DevID) and
> (ServiceDateTime = :ServiceDateTime)');
> qryLookUp.Parameters.ParamByName('DevID').Value := intDevID;
> qryLookUp.Parameters.ParamByName('ServiceDateTime').Value := serviceDate;
>
>
> "Shannon Walker" <shannon.walker@xxxxxxxxxx> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
> ÓÌÅÄÕÀÝÅÅ: news:42b19132@xxxxxxxxxxxxxxxxxxxxxxxxx
> > I tried the following:
> >
> > with qryLookUp.Parameters.AddParameter do begin
> > DataType := ftDateTime;
> > Direction := pdInput;
> > Name := 'SERVICE_DATE';
> > Value := serviceDate;
> > end;
> > qryLookUp.SQL.Add('SELECT * FROM ConcentratorRecords WHERE ((DevID =
'+
> > IntToStr(intDevID) + ') and (ServiceDateTime = '+
> > qryLookUp.Parameters[0].Name + '))');
> >
> > But now when the query is run it says SERVICE_DATE doesn't have a
default
> > value.
> >
> > I am not sure what I am doing wrong.
> >
> > "Opp" <nospam@xxxxxxxxxxxxxxx> wrote in message
> > news:9av2b1t3980ai8amnk3hb3r1lervqjjhj9@xxxxxxxxxx
> > > Here is a (brief) example of what that may look like..
> > >
> > > Here - IQ is the name of your ADO Query component..
> > >
> > >
> > > with IQ.Parameters.AddParameter do begin
> > > DataType := ftDateTime;
> > > Direction := pdInput;
> > > Name := 'ServiceDaeTime';
> > > Value := Date;
> > > end;
> > >
> > >
> > > Not Sure if setting the value in this way is correct - but you could
> > > try it.
> > >
> > > Paul.
> > >
> > >
> > >
> > >
> > > On Thu, 16 Jun 2005 08:24:58 -0400, "Shannon Walker"
> > > <shannon.walker@xxxxxxxxxx> wrote:
> > >
> > > >If I want to make my dateTime value a parameter in my query, what
would
> > that
> > > >look like?
> > > >
> > > >
> > > >"Brian Bushay TeamB" <BBushay@xxxxxxxxx> wrote in message
> > > >news:ckn1b11k514rq2a4vutkvnujspv431e8a9@xxxxxxxxxx
> > > >> >I am using a TADOQuery in order to search through a table of
records
> > for
> > > >a
> > > >> >date value. I can't seem to get the syntax right when specifying
> the
> > SQL
> > > >> >statement though. I have the following:
> > > >> >
> > > >> > qryLookUp.SQL.Add('SELECT * FROM table1 WHERE ((DevID = '+
> > > >> >IntToStr(intDevID) + ') and (ServiceDateTime = #' + serviceDate +
> '#'
> > > >> >+'))');
> > > >> >
> > > >> >serviceDate above is a string containing the date and time I am
> > looking
> > > >for.
> > > >> >ServiceDateTime DateTime field in MS Access.
> > > >> >
> > > >> >I get an error that says 'Parameter object is improperly defined'.
> > Does
> > > >> >anyone know the syntax for doing a search for a date value?
> > > >>
> > > >> Use a parameter in your query for the dateTimeValue
> > > >> Then set the value of the parameter.
> > > >> Or format you Time value to use "." instead of ":" as the separator
> and
> > > >drop the
> > > >> "#" characters just quote the dateTimevalue
> > > >>
> > > >>
> > > >>
> > > >> --
> > > >> Brian Bushay (TeamB)
> > > >> Bbushay@xxxxxxxxx
> > > >
> > >
> >
> >
>
>
.
- References:
- TADOQuery and Date fields problem
- From: Shannon
- Re: TADOQuery and Date fields problem
- From: Brian Bushay TeamB
- Re: TADOQuery and Date fields problem
- From: Shannon Walker
- Re: TADOQuery and Date fields problem
- From: Opp
- Re: TADOQuery and Date fields problem
- From: Shannon Walker
- Re: TADOQuery and Date fields problem
- From: Vitali Kalinin
- TADOQuery and Date fields problem
- Prev by Date: Re: TADOQuery and Date fields problem
- Next by Date: Re: Aggregate fields and .IsNull
- Previous by thread: Re: TADOQuery and Date fields problem
- Next by thread: refrash grid after chnges
- Index(es):
Relevant Pages
|