执行代码如下:
procedure TPCodemainfrm.ViewPCodeIDClick(Sender: TObject);
begin ComboBox1.Text:='';
ReportView.Enabled:=True; cxGrid1DBTableView1.DataController.DataSource:=dms.datasPCodeID; cxGrid1DBTableView1ident.Visible:=True;
cxGrid1DBTableView1a1.Visible:=True;
cxGrid1DBTableView1a2.Visible:=True;
cxGrid1DBTableView1a3.Visible:=True; cxGrid1DBTableView1P_CodeID.Visible:=false;
cxGrid1DBTableView1ColorID.Visible:=false;
cxGrid1DBTableView1Weigth.Visible:=false; cxGrid1DBTableView1ColorID1.Visible:=false;
cxGrid1DBTableView1Chinesename.Visible:=false;
cxGrid1DBTableView1Englishname.Visible:=false;//dms.AdoPCodeID的DataSource是指向dms.datasPCodeID
//采用了cxGrid第三方组件 with dms.AdoPCodeID do
begin
Close;
SQL.Clear;
SQL.LoadFromFile(WPath+'\SQL\SearchRecords.sql');
Open;
end;end;老是出现
“Project XXX.EXE raised exception class EoleException With Message '第一行:'?'附近有语法错误。'.”的问题。
我检查了SQL查询语句,在查询分析器里是正常的,没有问题,我把查询语句放到ADOQuery的WideString里也是正常显示!就是用一个按钮来执行的话就会出现那个问题!
我的D2006是正版的!在D7里是没有问题的!会不会是D2006的问题?请高手不吝赐教!
谢谢!
解决方案 »
- 庚寅年除夕夜,给大家拜年啦
- 有谁知道用DELPHI通过ADO访问MS SQL数据库的编程实例。
- 一个困扰我几天的问题
- 调用完excel后怎么删掉进程?
- 关于不同数据库移植问题
- 求助: 怎样得到一个EXE程序被安装的路径名和EXE程序名?
- Invalid typecast:string(cbxName.Items.Objects[cbxName.ItemIndex]),怎么写?
- 用dm1.ADOTable2.filter:= '商品类型 ="音箱"';语句为什么总是得到一个空记录,我的数据库里有符合要求的记录,
- 我是菜鸟!谁可帮我!
- Delphi7的编辑器如何让代码后退和前进?
- 紧急求助:如何在delphi中实现word文档的打印
- 兼职DELPHI(成都)
(
ident int,
a1 varchar(10),
a2 varchar(10),
a3 varchar(10),
a4 varchar(10),
a5 varchar(10),
)declare @t1 integer
declare @t2 integer
declare @t3 integer
declare @t4 integer
declare @t5 integerset @t1 = 1
set @t2 = 1
set @t3 = 1
set @t4 = 1
set @t5 = 1declare @str varchar(50)
declare @colname varchar(50)
declare A_Cursor cursor for select DISTINCT P_CodeID from PCodeColores order by P_CodeID
open A_Cursorwhile ( 1 > 0)
begin
fetch next from A_Cursor into @str
if ( @@FETCH_STATUS <> 0 ) break
--插入操作
if (substring(@str,1,3) = 'p11')
begin
print('@1')
if exists( select a1 from #temptable where ident = @t1 )
begin
update #temptable
set a1 = @str
where ident = @t1
end
else
begin
insert into #temptable (ident,a1) values (@t1,@str)
end
set @t1 = @t1+1
end if (substring(@str,1,3) = 'p12')
begin
print('@2')
if exists( select a2 from #temptable where ident = @t2 )
begin
update #temptable
set a2 = @str
where ident = @t2
end
else
begin
insert into #temptable (ident,a2) values (@t2,@str)
end
set @t2 = @t2+1
end if (substring(@str,1,3) = 'p13')
begin
print('@3')
if exists( select a3 from #temptable where ident = @t3 )
begin
update #temptable
set a3 = @str
where ident = @t3
end
else
begin
insert into #temptable (ident,a3) values (@t3,@str)
end
set @t3 = @t3+1
end if (substring(@str,1,3) = 'p14')
begin
print('@4')
if exists( select a4 from #temptable where ident = @t4 )
begin
update #temptable
set a4 = @str
where ident = @t4
end else
begin
insert into #temptable (ident,a4) values (@t4,@str)
end
set @t4 = @t4+1
end if (substring(@str,1,3) = 'p15')
begin
print('@5')
if exists( select a5 from #temptable where ident = @t5 )
begin
update #temptable
set a5 = @str
where ident = @t5
end
else
begin
insert into #temptable (ident,a5) values (@t5,@str)
end
set @t5 = @t5+1
end print(@str)end
close A_Cursor
deallocate A_Cursorselect * from #temptabledrop table #temptable没有使用外部参数!
在D7里是没有问题的!谢谢!
(
ident int,
a1 varchar(10)
)declare @t1 integerset @t1 = 1declare @str varchar(50)
declare @colname varchar(50)
declare A_Cursor cursor for select DISTINCT P_CodeID from PCodeColores order by P_CodeID
open A_Cursorwhile ( 1 > 0)
begin
fetch next from A_Cursor into @str
if ( @@FETCH_STATUS <> 0 ) break
--插入操作
if (substring(@str,1,3) = 'p11')
begin
print('@1')
if exists( select a1 from #temptable where ident = @t1 )
begin
update #temptable
set a1 = @str
where ident = @t1
end
else
begin
insert into #temptable (ident,a1) values (@t1,@str)
end
set @t1 = @t1+1
end print(@str)end
close A_Cursor
deallocate A_Cursorselect * from #temptabledrop table #temptable没有使用外部参数!
在D7里是没有问题的!谢谢!
所以速度还是可以的!
一般一秒就可以了!
呵呵~~~~~~~~~~
To erhan()
你觉得存储过程怎么写比较好呢?
请赐教啦!
谢谢!
你的SQL文件是不是Ansi的格式,还是Utf-8还是Unicode,如果不是Ansi格式的你要转换成Ansi格式的,否则可能会出现这种错误。
(
ident int,
a1 varchar(10),
a2 varchar(10),
a3 varchar(10),
a4 varchar(10),
a5 varchar(10),
)
a5这一行后面是不是多了个逗号呢?这句话在sql下面的确是可以执行的
CREATE PROCEDURE SearchRecords
AS
--以下加入你的代码
存储过程是在服务器上加的哈,应该知道的吧delphi中的调用方法
adoquery1.sql.text := 'exec SearchRecords'
adoquery1.ExecSQL;
adoquery1.sql.text := 'exec SearchRecords';
adoquery1.open;