Since you're already using an ADOQuery, why not get ADO to do the
work for you.
ADO can automatically format the date correctly for whatever database
system you're using, instead of you trying to format the date
yourself.
Here's how.
y := StrToInt(txtYearFa.Text);
m := StrToInt(txtMonthFa.Text);
d := StrToInt(txtDayFa.Text);
year := EncodeDate(y,m,d);
day := 'SELECT * FROM checks WHERE idates = :year';
ADOQuery1.Close;
ADOQuery1.SQL.Add(day);
ADOQuery1.Parameters.ParamByName('year').DataType := ftDate;
ADOQuery1.Parameters.ParamByName('year').Value := year;
ADOQuery1.Open;
Edit4.Text := etc, etc.
This may not fix your problem, but it's a start.
Ian.
--- In delphi-en%40yahoogroups.com">delphi-en
yahoogroups.com, sara-arian <aban4009
...> wrote:
>
> hi groupmates
> I have a problem in my select command. It never return any record
but there are some records containing wanted feilds.
> the 'year' value is alike what is in my table 'checks' but 'item'
always will be 0. my code is as following:
> year := txtYearFa.Text+'/'43;txtMonthFa.Text+'/'+txtDayFa.Text;
> Edit1.Text:=year;
> day:= 'select * from checks where idates ='+''''3;year+'''';
> AdoQuery1.Close;
> AdoQuery1.SQL.Clear;
> AdoQuery1.SQL.Add(day);
> item:=AdoQuery1.ExecSQL;
> Edit4.Text:=AdoQuery1.FieldValues['bank'].AsString;
> Edit2.Text:=AdoQuery1.FieldValues['iprices'].AsString;
> Edit3.Text:=AdoQuery1.FieldValues['inames'].AsString;
> The error is "adoquery1 :feild 'bank not found.
> I don't know what to do please help me. thenk you
>
>
> ---------------------------------
> Boardwalk for $500? In 2007? Ha!
> Play Monopoly Here and Now (it's updated for today's economy) at
Yahoo! Games.
>
> [Non-text portions of this message have been removed]
>
.