J
jsyzzdj
Unregistered / Unconfirmed
GUEST, unregistred user!
PROCEDURE [insert_userload]
(@userid_1 [int],
@username_2 [char](4))
AS INSERT INTO [hissys].[dbo].[userload]
( [userid],
[username])
VALUES
( @userid_1,
@username_2)
存储过程insert_userload
、、、、、、、、、、、、、、、
com com_zdj中
function Tcom_zdj.insertdb(const procame: WideString;
paramvalue: OleVariant): OleVariant;
type
TData=array [0..999] of Variant;
var m:integer;
Data:TData;
begin
try
result:=false;
adoconnection.begin
Trans;
ADOStoredProc1.ProcedureName:=procame;
ADOStoredProc1.Parameters.Clear;
for m:=1 to ADOStoredProc1.Parameters.Count-1do
begin
Data[m-1]:=paramvalue[m-1];
ADOStoredProc1.Parameters.Add;
ADOStoredProc1.Parameters[m].Value:=Data[m-1];
end;
ADOStoredProc1.Prepared;
ADOStoredProc1.ExecProc;
adoconnection.CommitTrans;
result:=true;
except
result:=false;
adoconnection.RollbackTrans;
end;
end;
/////////////
调用
procedure TForm1.Button3Click(Sender: TObject);
var
D1:Variant;
COMSvr : Icom_zdj;
retStr : boolean;
linkstr,authstr:string;
bz:OleVariant;
begin
linkstr:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hissys;Data Source=admin';
COMSvr := CreateComObject(CLASS_com_zdj) as Icom_zdj;
if COMSvr <> nil then
begin
retStr := COMSvr.adolink(linkstr);
d1:= VarArrayCreate([0,1], varVariant);
d1[0]:=23253 ;
d1[1]:='jsyzzdj';
bz:=COMSvr.insertdb('insert_userload;1',d1);
end;
end;
////////////////////////
、、、、、、、、、
COM对象中调用存储过程通过Variant传递数组失败
(@userid_1 [int],
@username_2 [char](4))
AS INSERT INTO [hissys].[dbo].[userload]
( [userid],
[username])
VALUES
( @userid_1,
@username_2)
存储过程insert_userload
、、、、、、、、、、、、、、、
com com_zdj中
function Tcom_zdj.insertdb(const procame: WideString;
paramvalue: OleVariant): OleVariant;
type
TData=array [0..999] of Variant;
var m:integer;
Data:TData;
begin
try
result:=false;
adoconnection.begin
Trans;
ADOStoredProc1.ProcedureName:=procame;
ADOStoredProc1.Parameters.Clear;
for m:=1 to ADOStoredProc1.Parameters.Count-1do
begin
Data[m-1]:=paramvalue[m-1];
ADOStoredProc1.Parameters.Add;
ADOStoredProc1.Parameters[m].Value:=Data[m-1];
end;
ADOStoredProc1.Prepared;
ADOStoredProc1.ExecProc;
adoconnection.CommitTrans;
result:=true;
except
result:=false;
adoconnection.RollbackTrans;
end;
end;
/////////////
调用
procedure TForm1.Button3Click(Sender: TObject);
var
D1:Variant;
COMSvr : Icom_zdj;
retStr : boolean;
linkstr,authstr:string;
bz:OleVariant;
begin
linkstr:='Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hissys;Data Source=admin';
COMSvr := CreateComObject(CLASS_com_zdj) as Icom_zdj;
if COMSvr <> nil then
begin
retStr := COMSvr.adolink(linkstr);
d1:= VarArrayCreate([0,1], varVariant);
d1[0]:=23253 ;
d1[1]:='jsyzzdj';
bz:=COMSvr.insertdb('insert_userload;1',d1);
end;
end;
////////////////////////
、、、、、、、、、
COM对象中调用存储过程通过Variant传递数组失败