您的位置:首页 > 编程语言 > C语言/C++

关于c++使用sql语句调用 mysql数据库中带参函数的方法

2012-10-30 01:07 1126 查看
在数据库中定义函数:类似下面这样 函数名为 myfun

begin

declare rguid int default -1;

declare result int default -1;

start transaction;

insert into mytable(a,b,c)

values (pa,pb,pc);

select row_count() into result;

if result > 0 then

update mytble2 set m=1 where m= pa;

end if;

commit;

end



然后定义参数: pa int,pb int,pc int



最后就是关键的sql调用了:

char strSql = "call myfun (123,123,123) ";

下面执行sql, 大功告成!!! 这个东西我找了整整一天,很多论坛和官方都说的很模糊很偏。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: