打开APP
userphoto
未登录

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

开通VIP
Step 2. Executing a simple SQL command
#include <stdio.h>  // for printf#include <SQLAPI.h> // main SQLAPI++ headerint main(int argc, char* argv[]){    SAConnection con; // connection object    SACommand cmd;    // create command object        try    {        // connect to database (Oracle in our example)        con.Connect("test", "tester", "tester", SA_Oracle_Client);        // associate a command with connection        // connection can also be specified in SACommand constructor        cmd.setConnection(&con);        // create table        cmd.setCommandText(            "Create table test_tbl(fid integer, fvarchar20 varchar(20), fblob blob)");        cmd.Execute();        // insert value        cmd.setCommandText(            "Insert into test_tbl(fid, fvarchar20) values (1, 'Some string (1)')");        cmd.Execute();        // commit changes on success        con.Commit();        printf("Table created, row inserted!\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你的财运
让 Python 更加充分的使用 Sqlite3
C#执行DOS命令(CMD命令)
SQL 事务的两种用法
掌握VB中的ADO数据对象编程
[精华] 在Oracle运行操作系统命令 (转载)
面向切片编程(AOP)应用的一些实际例子
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服