当然可以
添加StoredProc控件,设置StoredProcedureName设为'dbo.db_backup',再根据存储过程db_backup的参数设置StoredProc的Params属性.
如:
有一存储过程GetEmployeeCount
Create Procedure GetEmployeeCount@InJobID int,@OutCount int out as Select @OutCount=Count(*) From employee Where Job_id=@InJobID
意思是根据Job_id查询属于这个Job_id的总人数OutCount
调用:
StoredProcedureName为dbo.GetEmptyeeCount
Params为:
TStoredProc.Params[0] DataType=ftInteger
ParamType=ptInput
value.Type=Byte
TStoredProc.Params[1] DataType=ftInteger
ParamType=ptOutput
value.Type=Byte代码:
Begin
try
StoredProc1.Params[1].value:=StrToInt(EditJobID.text);
StoredProc1.Prepare;
StoredProc1.ExecProc;
EditCount.Text:=IntToStr(StoredProc1.Params[2].value);
finally
ShowMessage('Ok');
end;
end;手都打累了,够了吧?
添加StoredProc控件,设置StoredProcedureName设为'dbo.db_backup',再根据存储过程db_backup的参数设置StoredProc的Params属性.
如:
有一存储过程GetEmployeeCount
Create Procedure GetEmployeeCount@InJobID int,@OutCount int out as Select @OutCount=Count(*) From employee Where Job_id=@InJobID
意思是根据Job_id查询属于这个Job_id的总人数OutCount
调用:
StoredProcedureName为dbo.GetEmptyeeCount
Params为:
TStoredProc.Params[0] DataType=ftInteger
ParamType=ptInput
value.Type=Byte
TStoredProc.Params[1] DataType=ftInteger
ParamType=ptOutput
value.Type=Byte代码:
Begin
try
StoredProc1.Params[1].value:=StrToInt(EditJobID.text);
StoredProc1.Prepare;
StoredProc1.ExecProc;
EditCount.Text:=IntToStr(StoredProc1.Params[2].value);
finally
ShowMessage('Ok');
end;
end;手都打累了,够了吧?
解决方案 »
- ACCESS数据库开发时,如何隐藏其中某个字段的某个记录
- 关于把adoquery过滤的值赋给edit.text的问题,很简单的?
- 软件无忧1.0(beta 1)
- 报表一问
- 如何做浮动窗体啊~~~~~~~~谢谢!
- 求Delphi中处理gif图片的控件?[email protected] 高分在线等待。
- Access Violation 00000000 .
- 有谁知道,为什么有时用delphi打开一个应用程序时,如果再执行该程序的exe文件,怎么报错那,而且还不能关闭,只能用调试,再打开个delphi窗口,然后才能关闭。
- 如何控件字体设置
- 关于动态数组(array of Tlistview)
- 求救!长连接和短连接
- 在DBGrid上添加一条记录时,怎样才能使它一定要添完本记录后,才能移动到另一条记录?
我问的没表达清楚,我要调用的是sql server中的系统存储过程,不是自定义的。
在此调用的应是backup或restore,但在StoredProcedureName并没有这两个,仅有我自定义的,
要想用系统存储过程是不是还要设控件的其它属性值,但我没找到。
如果您知道的话,不妨再麻烦您一下。十分谢谢!
把要備份的數據往里面塞