Delphi SQL statement string

Source: Internet
Author: User
Delphi SQL statement string problems Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061215232313281.html
Select *
From saveque
Where rdate <#2006-12-7 #;
(Access Library)
The preceding SQL statement is stored in adoquery1. SQL. Add ('select CPN from saveque where rdate <'+' # ''+ datetostr (datetimepicker1.date) + '#' + '').

What should I do! I'm a cainiao. Help me!
In addition! Is this SQL query statement also written in sql2000server?
Another question is, how can I write a range query?
For example, all data between and? Thank you.

Adoquery1. SQL. Add ('select CPN from saveque where rdate <?? ')
Adquser. Parameters. parambyname ('?? '). Value: = datetostr (datetimepicker1.date)

Select CPN from saveque where rdate <''' + '#' + datetostr (datetimepicker1.date) + '#' +''
Note that rdate <''' is enclosed by two quotation marks.

This is correct, and I have verified it:
select CPN from saveque where rdate <# '+ datetostr (datetimepicker1.date) + '#'
MSSQL writes select CPN from saveque where rdate <'+ datetostr (datetimepicker1.date);
specifies the search range (MSSQL): Select CPN from saveque where rdate between ''' + datettostr (datetimepicker1.date) + ''' and ''' + datettostr (datetimepicker2.date) + '''

In MSSQL, select CPN from saveque where rdate <'+ datetostr (datetimepicker1.date );

---------------------------------------

Sorry, it should be:

Sqlstr: = 'select CPN from saveque where rdate <''' + datetostr (datetimepicker1.date) + '''';

The best method is as follows:

'Select CPN from saveque where rdate <:'

Then put the following sentence in front of adoquery1.open.
Adoquery1.parameters. parambyname ('A'). Value: = trim (datetimepicker1.date );

Kill in access and sqlsever!

The last one is simple and clear! Close the post! Score for participation! Thank you!

Post completion

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.