有关存储过程capbility not supported

风中的男子 2002-12-04 05:27:33
spMain->ExecProc();
spMain->UnPrepare(); //数据库错误:capbility not supported
...全文
76 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
风中的男子 2002-12-25
  • 打赏
  • 举报
回复
说明: 这个存储过程在sqlserver中是没有任何问题,已调试通过
风中的男子 2002-12-25
  • 打赏
  • 举报
回复
AnsiString __fastcall TDataModuleMain::GetRegTables(void)
{
int return_code;
spMain->Close(); //程序开始运行时这里访问冲突
spMain->StoredProcName="p_GetRegTables";
spMain->Prepare();
spMain->ExecProc(); //在程序中再次调用时说capability not SUPPORTED

return_code=spMain->ParamByName("@RETURN_VALUE")->AsInteger;


if(return_code!=-1)
{
AnsiString tables;
tables = spMain->ParamByName("@AllTables")->AsString;
return tables;
}
else
return "";
}
下边是存储过程:

create proc p_GetRegTables
@AllTables varchar(510) output --01 到ff 个tableID
as
/*
获得所有注册的tableID
-1 没有满足条件的记录
0 成功
*/
begin
if not exists(select *from nameserver where terminate_type=1)
return -1

set @AllTables=''

begin transaction
declare @iTable tinyint
declare @table varchar(2)
declare cursor_table cursor for
select distinct table_id from NameServer

open cursor_table

if @@cursor_rows=0
begin
close cursor_table
deallocate cursor_table
commit transaction
return 0
end

fetch next from cursor_table into @iTable

while @@fetch_status=0
begin
exec p_TinyintToHex @iTable,@table output --255->FF
set @AllTables=@AllTables+@table
fetch next from cursor_table into @iTable
end

close cursor_table
deallocate cursor_table

commit transaction

end
go
JuncoZhan 2002-12-23
  • 打赏
  • 举报
回复
int f()
{
int return_code;

spAction->Close();
spAction->StoredProcName="p_RegisterTable";
spAction->Prepare(); //如果不反复执行,该语句可以不用
spAction->ParamByName("@table_id")->AsString=TableId;
spAction->ParamByName("@pass_word")->AsString=Password;
spAction->ExecProc();
return_code=spAction->ParamByName("@return_value")->AsInteger;
//spAction->UnPrepare(); //去掉!人家sqlserver不支持,收效也不明显
return return_code;
}
风中的男子 2002-12-23
  • 打赏
  • 举报
回复
数据库是sqlserver
看cb的帮助说是关心返回值的话用open
即:spAction->Open();
可是结果还是出现上面的错误提示
没有人解答吗?
风中的男子 2002-12-05
  • 打赏
  • 举报
回复
sqlserver的数据库.程序需要调用很多的存储过程.他们放在不通的函数中
下边是一个完整的使用过程
int f()
{
int return_code;

spAction->Close();
spAction->StoredProcName="p_RegisterTable";
spAction->Prepare();
spAction->ParamByName("@table_id")->AsString=TableId;
spAction->ParamByName("@pass_word")->AsString=Password;
spAction->ExecProc();
spAction->UnPrepare();
return_code=spAction->ParamByName("@return_value")->AsInteger;
return return_code;
}
zbc 2002-12-04
  • 打赏
  • 举报
回复
UnPrepare是释放服务器端已经准备好的资源,你打开store procedure后,为什么又要释放呢?你用的是什么数据库?
WhyAndAnswer 2002-12-04
  • 打赏
  • 举报
回复
为什么要写spMain->UnPrepare();

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧