if edit1.Text<>'' then a:=''''+edit1.Text+'''';
if edit2.Text<>'' then b:=''''+edit2.Text+'''';
if edit3.Text<>'' then c:=''''+edit3.Text+'''';
少了一些‘'’
if edit2.Text<>'' then b:=''''+edit2.Text+'''';
if edit3.Text<>'' then c:=''''+edit3.Text+'''';
少了一些‘'’
解决方案 »
- 感情失落
- 送分!我在文件》新建》窗体中新建了一个窗体form2,却不能在form1中用show调用!为什么啊?
- 怎么把DELPHI的子窗口图标显示在工具栏?
- 换成TADOTable就正确。换成 TDataSet就错误,而现在必须要用TDataSet!!怎么办????
- 如何用fastreport或者QuickReport实现在一张纸上并排打印两张表,这两张表又是不同的数据源?很急
- 急了又急,你会帮助我吗?
- 一个关于Web Server Application的问题!急!!!
- 我要向QQ2000的输入框中用程序来自动输入文字,要用什么方法
- Record/Key deleted
- 当DBGRID中的某列为编辑状态时(即按下回车,光标闪动),如何让它在关闭所在窗口前转为浏览状态?
- 这个问题比较有水平,有兴趣的进来看看........
- 节骨眼上的一刀,伯乐在哪里?(老鱼)
+a+
''',@b='''+b+
''',@c='''+c+
'''');
strSQL: String;
begin
strSQL := 'exec query2 ';
if if edit1.Text<>'' then
strSQL := strSQL + ' a = '''+edit1.Text+''','
if if edit2.Text<>'' then
strSQL := strSQL + ' a = '''+edit2.Text+''','
if if edit3.Text<>'' then
strSQL := strSQL + ' a = '''+edit3.Text+''','
if strSQL[Length(strSQL)] = ',' then
strSQL := Copy(strSQL,1,Length(strSQL) - 1);datamodule2.ADOQuery2.close;
datamodule2.ADOQuery2.sql.clear;
datamodule2.ADOQuery2.sql.add(strSQL);
datamodule2.ADOQuery2.Open;
(
@a varchar(20)=null,
@b varchar(20)=null,
@c varchar(20)=null
)
as
begin
declare @sSQL varchar(200)
select @sSQL = 'select * from basicinfo where 1 = 1 '
if @a is not null
select @sSQL = ' and name1 like '%''+ @a +''%''
if @b is not null
select @sSQL = ' and name2 like '%''+ @b +''%''
if @c is not null
select @sSQL = ' and name3 like '%''+ @c +''%''
execute(@sSQL)end