S
sun_hong_jun
Unregistered / Unconfirmed
GUEST, unregistred user!
本人想测验一下存储过程的效果,举了一个例子如下“
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, StdCtrls, DB, Grids, DBGrids, DBTables;
type
TForm1 = class(TForm)
Query: TQuery;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Button1: TButton;
DBNavigator1: TDBNavigator;
Table1: TTable;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
dbgrid1.EditorMode :=true;
with query do
begin
close;
with sql do
begin
clear;
add('update products set supplierid=3');
end;
prepare;
open;
end;
end;
end
且关于products表的触发器定义如下:.
create trigger tr_product_update on products
for update
as
declare @msg varchar(100)
set @msg=str(@@rowcount)+'employees updated by this statement'
print @msg
go
运行以后,出现错误提示:'error create cursor handle',为什么?
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, DBCtrls, StdCtrls, DB, Grids, DBGrids, DBTables;
type
TForm1 = class(TForm)
Query: TQuery;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
Button1: TButton;
DBNavigator1: TDBNavigator;
Table1: TTable;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
dbgrid1.EditorMode :=true;
with query do
begin
close;
with sql do
begin
clear;
add('update products set supplierid=3');
end;
prepare;
open;
end;
end;
end
且关于products表的触发器定义如下:.
create trigger tr_product_update on products
for update
as
declare @msg varchar(100)
set @msg=str(@@rowcount)+'employees updated by this statement'
print @msg
go
运行以后,出现错误提示:'error create cursor handle',为什么?