Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
技术板块灌水区
» 菜鸟求助
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: 菜鸟求助
cacausia
新警察
UID 40588
Digest Posts 0
Credits 4
Posts 1
点点分 4
Reading Access 10
Registered 2008-6-21
Status Offline
#1
Post at 2008-6-22 00:24
Profile
|
Blog
|
P.M.
菜鸟求助
我想用双变量查询,可是怎么也不行?
sql.add('select 姓名 from shujukeming where '+cxzd+' like''''%'+cxnr+'%''');
cxzd cxnr都是变量,应该怎么改?
bahamut8348
灌水司司长
UID 4743
Digest Posts
14
Credits 337
Posts 79
点点分 337
Reading Access 10
Registered 2007-1-18
Status Offline
#2
Post at 2008-6-22 10:53
Profile
|
Blog
|
P.M.
[Copy to clipboard]
CODE:
var
ColumnName, Value: string;
begin
ColumnName:= 'your Column Name';
Value:= '...';
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('SELECT * FROM TabelName WHERE ' + ColumnName + ' LIKE ''%' + Value + '%''');
ADOQuery1.Open;
end;
注意单引号的个数
做人要厚道,看帖要回贴
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-24 02:51
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.009561 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats