year := txtYearFa.Text+ '/'+txtMonthFa. Text+'/'+ txtDayFa. Text;
Edit1.Text:= year;
day:= 'select * from checks where idates =:idates';
AdoQuery1.Close;
Adoquery.ExecuteOptions := Adoquery.ExecuteOptions - [eoExecuteNoRecords];
AdoQuery1.SQL. Clear;
AdoQuery1.SQL. Add(day);
AdoQuery1.prepared=true;
AdoQuery1.Parameters.ParamByName('idates').value := encodedate(strtoint(txtYearFa.Text),strtoint(txtMonthFa. Text),strtoint(txtDayFa.Text));
AdoQuery1.Open;
or
AdoQuery1.Active := true;
Use parameters instead of direct sql.
For a date is better to encode the date yourself.
Use open, instead of ExecSql.
Adrian
----- Message d'origine ----
De : Arsen Khachatryan < cragrer%40yahoo.com">cragrer
yahoo.com>
À : delphi-en%40yahoogroups.com">delphi-en
yahoogroups.com
Envoyé le : Jeudi, 16 Août 2007, 11h36mn 19s
Objet : Re: [delphi-en] problem in select command.please help
give me the whole sql code plz will try to help you
sara-arian <aban4009
yahoo. com> 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+ '/'+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]
------------ --------- --------- ---
Need a vacation? Get great deals to amazing places on Yahoo! Travel.
[Non-text portions of this message have been removed]
<!--
#ygrp-mlmsg {font-size:13px;font-family:arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg table {font-size:inherit;font:100%;}
#ygrp-mlmsg select, input, textarea {font:99% arial, helvetica, clean, sans-serif;}
#ygrp-mlmsg pre, code {font:115% monospace;}
#ygrp-mlmsg * {line-height:1.22em;}
#ygrp-text{
font-family:Georgia;
}
#ygrp-text p{
margin:0 0 1em 0;}
#ygrp-tpmsgs{
font-family:Arial;
clear:both;}
#ygrp-vitnav{
padding-top:10px;font-family:Verdana;font-size:77%;margin:0;}
#ygrp-vitnav a{
padding:0 1px;}
#ygrp-actbar{
clear:both;margin:25px 0;white-space:nowrap;color:#666;text-align:right;}
#ygrp-actbar .left{
float:left;white-space:nowrap;}
.bld{font-weight:bold;}
#ygrp-grft{
font-family:Verdana;font-size:77%;padding:15px 0;}
#ygrp-ft{
font-family:verdana;font-size:77%;border-top:1px solid #666;
padding:5px 0;
}
#ygrp-mlmsg #logo{
padding-bottom:10px;}
#ygrp-vital{
background-color:#e0ecee;margin-bottom:20px;padding:2px 0 8px 8px;}
#ygrp-vital #vithd{
font-size:77%;font-family:Verdana;font-weight:bold;color:#333;text-transform:uppercase;}
#ygrp-vital ul{