L
lisongmagic
Unregistered / Unconfirmed
GUEST, unregistred user!
不好意思,刚才开会n忙
存储过程:
if exists(select name from sysobjects where name = 'lisongmagic'and type = 'p')
drop procedure lisongmagic
go
create procedure lisongmagic
as
if exists( select id from tempdb.dbo.sysobjects where id = object_id('tempdb.dbo.'+'##abc'))
drop table ##abc
create table ##abc
(
name varchar(50) null
)
insert into ##abc(name)values('lisongmagicxx')
select * from ##abc
go
前台调用:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
with ADOQuery1do
begin
close;
sql.Text:= 'exec lisongmagic';
open;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ADOQuery1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist '
+'Security Info=False;Initial Catalog=lisongmagic;Data Source=DEVE-LISONG/BILL2006';
end;
end.
已运行过,结果正确。
存储过程:
if exists(select name from sysobjects where name = 'lisongmagic'and type = 'p')
drop procedure lisongmagic
go
create procedure lisongmagic
as
if exists( select id from tempdb.dbo.sysobjects where id = object_id('tempdb.dbo.'+'##abc'))
drop table ##abc
create table ##abc
(
name varchar(50) null
)
insert into ##abc(name)values('lisongmagicxx')
select * from ##abc
go
前台调用:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, Grids, DBGrids, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ADOQuery1: TADOQuery;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
with ADOQuery1do
begin
close;
sql.Text:= 'exec lisongmagic';
open;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ADOQuery1.ConnectionString:='Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist '
+'Security Info=False;Initial Catalog=lisongmagic;Data Source=DEVE-LISONG/BILL2006';
end;
end.
已运行过,结果正确。