Home
Top.Mail.Ru Yandeks.Metrika
Forum: "Beginners";
Current archive: 2010.08.27;
Download: [xml.tar.bz2];

Down

ADOQuery + SQL-sampling by date !!! Find similar branches


Kukulkan   (2010-04-17 23:43) [0]

I could not understand what the problem is !!!

There is a table from the database that was created in Access, from which you need to get data by date! The DATE field is stored in the format DD.MM.RRRR
Here is the code I use in Delphi:

procedure TAReview.Button5Click (Sender: TObject);
was
i: TDateTime;
begin
i: = strtodate (edit4.text);

datamodule2.DataQuery.Active: = false;
datamodule2.DataQuery.SQL.Clear;
datamodule2.DataQuery.SQL.Add ("sele ct *");
datamodule2.DataQuery.SQL.Add ("from rent");
datamodule2.DataQuery.SQL.Add ("wher e date =" "+ i +" "");
datamodule2.DataQuery.Active: = true;

end;

As a result, I’m getting a message in the date field
Inconsistency of data types in the selection condition !!!

I was just trying to create one in sql access:
select *
from rent
where date = "23.03.2010/XNUMX/XNUMX"
The same mistake !!!
I’m just not sure what it is !!! Help me please!!! Very necessary!!! Thank you very much in advance!!!



turbouser ©   (2010-04-17 23:52) [1]


> Kukulkan (17.04.10 23:43)


with datamodule2 do
begin
 DataQuery.Active := false;
    with DataQuery do
      begin
        SQL.Text:="select * from [аренда]  where [дата]=:PARAM";
        Parameters.ParamValues[PARAM]:=i;
      end;
end;

wrote by hand ..
the main point is to use the parameters ..



turbouser ©   (2010-04-17 23:53) [2]


> ParamValues ​​["PARAM"]



turbouser ©   (2010-04-17 23:55) [3]

DataQuery.Active: = true;
:)
saturday .. evening .. :)



turbouser ©   (2010-04-18 00:01) [4]


> Kukulkan (17.04.10 23:43)

and, and also .. stars in the request nizya put .. choose what you need.



Anatoly Podgoretsky ©   (2010-04-18 00:24) [5]

> Kukulkan (17.04.2010/23/43 00:0:XNUMX PM) [XNUMX]

It is necessary to redo the table, the date must be made in the date format, and not "DD.MM.RRRR"
Otherwise, grief slur much more.



Kukulkan   (2010-04-18 00:33) [6]

thank you))))



turbouser ©   (2010-04-18 00:35) [7]


> Anatoly Podgoretsky © (18.04.10 00: 24) [5]


> It is necessary to redo the table

Why? The author just has a date field, not a string .. According to the locale he sees
> DATE is stored in the format DD.MM.RRRR

(instead of RRRR - YYYY, a small glass, as the telepath suggests) and all business ..



Kukulkan   (2010-04-18 00:39) [8]


> Anatoly Podgoretsky © (18.04.10 00: 24) [5]
>
>> Kukulkan (17.04.2010/23/43 00:0:XNUMX p.m.) [XNUMX]
>
> It is necessary to redo the table, the date must be made in the date format,
> and not "DD.MM.RRRR"
> Otherwise grief slurp much more.


By this "DD.MM.RRRR" I meant that the database’s date in the field can be stored as 15.12.2010/15/12 for example, and when prompted, it gives an error which I described above !!! On one forum they answered that access requires such a format 2010/15.12.2010/XNUMX! I tried - request earned !!! Current is a problem - I have the date stored in this format on XNUMX/XNUMX/XNUMX! Moreover, the field has a data type not text, namely a date !!! So even though the request worked, it is natural that with such a request, here:

select *
from rent
where date = 23/03/2010


In response, I will not receive any data due to the fact that my given field stores the date in the format 15.12.2010/XNUMX/XNUMX !!! What do you advise me to do !? Change the format for storing dates in a table ?!



turbouser ©   (2010-04-18 00:50) [9]


> Anatoly Podgoretsky © (18.04.10 00: 24) [5]

My teleporter has not broken yet :))



sniknik ©   (2010-04-18 01:04) [10]

> Moreover, the field has a data type not text, namely a date !!!
things are not compatible, either a date or a string in the format ... physical storage and the form of the visual presentation are two different things.

> My teleporter has not broken yet :))
sense then. it still hasn’t come to him ...



Германн ©   (2010-04-18 01:06) [11]


QuotedXNUMX>> My teleporter has not broken yet :))
> then the point. it still hasn’t come to him ...

But turbouser © calmed down. And then
> saturday .. evening .. :)



Kukulkan   (2010-04-18 01:08) [12]


> things are not compatible, either a date or a string in the format ..
>. physical storage and visual presentation form
> -different things.

Yes, I understand that!!! So who will advise the thread what to do !!! ???



turbouser ©   (2010-04-18 01:10) [13]


> sniknik © (18.04.10 01: 04) [10]


> then the point. it still hasn’t come to him ...

Perhaps it will come .. Although ..



turbouser ©   (2010-04-18 01:11) [14]


> Kukulkan (18.04.10/01/08 12:XNUMX) [XNUMX]

Hmm ..



Kukulkan   (2010-04-18 01:16) [15]

Deleted by moderator



sniknik ©   (2010-04-18 01:20) [16]

> So who will advise the thread what to do !!! ???
mantra for the night "date = number", "date = number". repeat 200 times until it reaches.
when "rooting" you can talk about more complex cases when the date is not quite a number, for example, a record.



sniknik ©   (2010-04-18 01:22) [17]

+ Neither simple nor "complex" cases have a format, only the representation of a number in a string has it (for display. basically).



Германн ©   (2010-04-18 01:25) [18]


>
> Yes, I understand that !!! So who will advise the thread what to do!
> !! ???

At first
> the main point is that you need to use the parameters
.
Secondly, read books.



Kukulkan   (2010-04-18 01:36) [19]


> mantra for the night "date = number", "date = number". to repeat
> 200 times until it reaches.
> when "root" you can talk about more complex cases
> when the date is not quite a number, but for example a record.


if they wrote once normally I would understand right away !!! And then I ask one thing and they tell me another !!! I understand that what we see in the tables on the screen in physical form inside the database may look like a friend !!! But I didn’t ask about it !!! I clearly stated the essence of the problem that I had !!! Because when working with my database, there were no problems with its tables !! The selection for both text and numeric fields worked fine !! And from the Date field, such a situation arose !!! I do not understand you!!! I asked this and that, and in reply to me with everything else !!! I, it seems, clearly wrote a field that I have the Date data type, that is, it does not appear to be text !!! Am I wrong to state the essence of the problem ?!



Kukulkan   (2010-04-18 01:39) [20]

Deleted by moderator



Kukulkan   (2010-04-18 01:41) [21]

And what “beyond mind” will be said to this message that I received in response to the same topic in one forum:


date format is different ...
you have 23.03.2010/23/03, and the accessory wants to see 2010/XNUMX/XNUMX
try the solution
Code:

DateSeparator: = "/";


??



turbouser ©   (2010-04-18 01:49) [22]


> Kukulkan (18.04.10/01/39 20:XNUMX) [XNUMX]


> Yeah !!! Maybe I should return to the first class !!! ????

Typical lamer. Well it is necessary. Straight on all grounds.



turbouser ©   (2010-04-18 01:57) [23]


> Kukulkan (18.04.10/01/41 21:XNUMX) [XNUMX]
>
> And what "beyond uma" will say

They will say that they don’t care. There are many forums. The same as you, too, darkness. At that forum, they either laughed at you, or idiots answered there.



Игорь Шевченко ©   (2010-04-18 01:57) [24]

Kukulkan (18.04.10/01/36 19:XNUMX) [XNUMX]

No shouting, no deaf here



Германн ©   (2010-04-18 01:57) [25]


> Maybe I still in the first class to return !!! ????

To a kindergarten. In the sandbox.



Kukulkan   (2010-04-18 02:00) [26]

Deleted by moderator



Kukulkan   (2010-04-18 02:04) [27]


> Igor Shevchenko

And no one and no oriot !!! Just shocked by such people who pose as gods !!! If such smart nafig sit on these forms ?!

I'm just shocked! Instead of help, one crap in return!
At that forum, they answered a different question once and it became clear to me !!! And here I’m trying to just pretend that I'm full 0 in programming !!! Well, the flag to you! ..



Плохиш ©   (2010-04-18 02:05) [28]


> I do not understand the meaning of writing me in response to this whole crap and not
> give advice!

Hmm, the advice was given in the first answer, and not just advice, but the code was given to the poor and destitute. And he whines ...

Why do you need this programming? There are many other activities.



Плохиш ©   (2010-04-18 02:06) [29]


> Kukulkan (18.04.10/02/04 27:XNUMX) [XNUMX]

LMD



Kukulkan   (2010-04-18 02:06) [30]

Deleted by moderator



sniknik ©   (2010-04-18 02:08) [31]

> I do not understand you !!! I asked this and that, and in reply to me with everything else !!!
I just don't understand you either. since you say understood that there are different things on the screen and inside the database, + the field has a data type of date (that is, it is NOT textual). then what nafig format? Why are you clinging to him?



Kukulkan   (2010-04-18 02:10) [32]

Deleted by moderator



sniknik ©   (2010-04-18 02:11) [33]

> with everything else !!!
this is the same, precisely in the context of the question (0) about the "stored". you just obviously still don’t understand.



Kukulkan   (2010-04-18 02:13) [34]


> sniknik © (18.04.10 02: 08) [31]
>
QuotedXNUMX>> I do not understand you !!! I asked this and that, and I answered with everything
> other !!!
> I also do not understand you. time you say understood that
> there are different things on the screen and inside the database, + the field has a data type
> date (i.e. is NOT textual). then what the hell
> format? Why are you clinging to him?


Firstly, maybe I was mistaken in writing the field format instead of the data type !!! There is probably wrong !!! Yes, it has a data type Date !!! There they first wrote to use the parameters in the request !!! And you can’t live without them ?! In other fields, the queries worked fine even without parameters ?!



sniknik ©   (2010-04-18 02:13) [35]

> Parameters say ?! I will try tomorrow!
and so far what have you been doing? those. "I don’t understand the answer, then I’ll throw it out and forget it" ... right? they started to "run over" well, they pushed them to the test.



Германн ©   (2010-04-18 02:13) [36]


> Okay! Speak parameters ?! I will try tomorrow! But will not help
> then I'll be back !!!

Scared. Already trembling!

PS The first time I write in my message these three letters LMD! But there are simply no other letters! :)



sniknik ©   (2010-04-18 02:17) [37]

> And you can not live without them?
possible, but it’s wrong. it's like turning the street into a red light. may not die, but someday the problems will all be one.
and you need to understand more, and in general it’s more difficult, but you “rested” on a simple one.



Kukulkan   (2010-04-18 02:17) [38]


QuotedXNUMX>> parameters say ?! I will try tomorrow!
> and so far what have you been doing? those. "I do not understand the answer, then
> I’ll throw it away and forget “... so?” they started “pushing” well, they pushed
> still on trial.


Yes, that’s not the point! I just found out solved this problem that arose in me !!! Now I’m doing other activities !!! What I wrote I will try! + First of all, I wrote above what I was still trying to achieve in return! Why is Axes acting this way ?! Well, the date is entered in the string as 15.12.2010/15/12 and the request is used on 2010/XNUMX/XNUMX ?! If he stores it in a different form, then what is obtained - the current parameters will help to solve the given problem ?!



Kukulkan   (2010-04-18 02:19) [39]

Deleted by moderator



turbouser ©   (2010-04-18 02:19) [40]


> Kukulkan (18.04.10/02/00 26:XNUMX) [XNUMX]
>
> You are defined by several SMS as a person !!! ??? Words
> no !!!

sms? As a person? no words?
years 14-16.



Германн ©   (2010-04-18 02:23) [41]


> Yes, that's not the point! I just find out solved this problem
> which has arisen with me !!!

Therefore, advice to read books.
For
> Why does Access behave this way ?! Well, the date is entered in the string as
> 15.12.2010/15/12 and the request is used on 2010/XNUMX/XNUMX ?! If
> he stores it in a different form, what turns out

- that's bullshit! Complete misunderstanding. sniknik © no matter how hard he tried, he achieved nothing.



Kukulkan   (2010-04-18 02:23) [42]

Deleted by moderator



sniknik ©   (2010-04-18 02:25) [43]

> Well, the date is entered in the string as 15.12.2010/XNUMX/XNUMX
and say something understood there? he cannot enter a "date like 15.12.2010/XNUMX/XNUMX" because the date is NUMBER (how much to repeat? This is what you generally asked the mantras for the night). where did you see the number 2 dots? (not to mention that a point is also part of the format for representing numbers, the number of points itself does not have)



Pages: 1 2 whole branch

Forum: "Beginners";
Current archive: 2010.08.27;
Download: [xml.tar.bz2];

Top





Memory: 0.72 MB
Time: 0.121 c
15-1269639003
Jury
2010-03-27 00:30
2010.08.27
Happy Birthday ! 27 March 2010 Saturday


3-1239559848
Alexander Stepanov
2009-04-12 22:10
2010.08.27
Problem connecting to the FireBird database


2-1272487277
Wadimka
2010-04-29 00:41
2010.08.27
Is it possible to do?


15-1266711780
KilkennyCat
2010-02-21 03:23
2010.08.27
586b clearly


15-1270812348
dars73
2010-04-09 15:25
2010.08.27
How to set up localization





afrikaans albanian Arabic armenian azerbaijani basque belarusian bulgarian catalan Chinese (Simplified) Chinese (Traditional) croatian Czech danish Dutch English estonian filipino finnish French
galician georgian German greek haitian Creole hebrew Hindi hungarian icelandic Indonesian Irish italian Japanese Korean latvian lithuanian macedonian malay maltese norwegian
persian polish portuguese Romanian russian serbian slovak Slovenian Spanish swahili Swedish ภาษาไทย turkish Ukrainian urdu Tiếng Việt welsh yiddish bengali bosnian
cebuano Esperanto gujarati hausa hmong igbo javanese kannada Khmer lao latin maori marathi mongolian nepali punjabi somali tamil telugu yoruba
zulu
English French German Italian Portuguese Russian Spanish