BCB调用SQL Server存储过程

/* 在SQLServer中建立存储过程 –DROP PROCEDURE Test; CREATE PROCEDURE Test @aa VARCHAR(15), @bb INT, @cc VARCHAR(15) OUTPUT, @dd INT OUTPUT AS BEGIN SELECT @cc=UPPER(@aa) PRINT @cc SELECT @dd=@bb+1 PRINT @dd RETURN END */ //c 和 d为输出的参数 AnsiString ls_One = "Wen Juan" ; int a = 888 ; AnsiString ls_Exec =AnsiString().sprintf("exec Test ‘%s’,%d, :c output,/ :d output",ls_One.c_str(),a); ADOQuery1->Close(); ADOQuery1->SQL->Clear(); ADOQuery1->SQL->Add(ls_Exec); ADOQuery1->ExecSQL() ; ShowMessage(ADOQuery1->Parameters->ParamByName("c")->Value); ShowMessage(ADOQuery1->Parameters->ParamByName("d")->Value); 

你可能感兴趣的:(sql,c,server,存储,sqlserver,output)