List Info

Thread: Re: problem in select command.please help




Re: problem in select command.please help
country flaguser name
United States
2007-08-16 08:25:17

sara-arian wrote:
> 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.

What were you expecting instead?

> my code is as following:
> year := txtYearFa.Text+'/'+txtMonthFa.Text+'/'+txtDayFa.Text;

Are you sure that generates a string that is appropriate for the data type
of the field you're comparing it to?

Are you sure that none of those edit boxes contain apostrophes, along with
other text that an SQL interpreter would understand? (See "SQL injection
attack" for details.)

> 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.

Please be sure you copy and paste the real error message. Do not type it
yourself.

Is there indeed a field named "bank"? Do any of the other statements work?
Does your code get results if you leave off the "where" clause?

--
Rob

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )