Mssql中的变量在delphi中如何调用(50分)

Z

ziyu

Unregistered / Unconfirmed
GUEST, unregistred user!
Mssql中:
create table table_1
(column_1 int not null,
column_2 char(10) null)
go
insert table_1 values (89,null)
go
declare @var1 int
set @var1=9
update table_1
set column_1=@var_1
where column_1=89
go
我想在delphi中动态的给@var_1赋值,这样的sql语句应该怎么写。
 
建立一个Query
设定参数
sql:='update table_1 set column_1=:var_1 where column_1=89
Query.Close;
Query.ParamByName('Var_1').Value:=xxx;
Query.Prepare;
Query.ExecSql
 
接受答案了.
 

Similar threads

I
回复
0
查看
676
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
549
import
I
I
回复
0
查看
641
import
I
顶部