打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Step 4. Executing a select query (and fetching result set)
#include <stdio.h>  // for printf#include <SQLAPI.h> // main SQLAPI++ headerint main(int argc, char* argv[]){    SAConnection con; // connection object    SACommand cmd(        &con,        "Select fid, fvarchar20 from test_tbl");    // command object        try    {        // connect to database (Oracle in our example)        con.Connect("test", "tester", "tester", SA_Oracle_Client);        // Select from our test table        cmd.Execute();        // fetch results row by row and print results        while(cmd.FetchNext())        {            printf("Row fetched: fid = %ld, fvarchar20 = '%s'\n",                 cmd.Field("fid").asLong(),                (const char*)cmd.Field("fvarchar20").asString());        }        // commit changes on success        con.Commit();        printf("Rows selected!\n");    }    catch(SAException &x)    {        // SAConnection::Rollback()        // can also throw an exception        // (if a network error for example),        // we will be ready        try        {            // on error rollback changes            con.Rollback();        }        catch(SAException &)        {        }        // print error message        printf("%s\n", (const char*)x.ErrText());    }        return 0;}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
SQL 事务的两种用法
C语言定时关机小程序_C语言中文网
指纹模块
GSC3280的ADC子系统驱动模型(二)
C语言操作MYSQL小例子
MySQL的Embedded模式C接口
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服