卑鄙的张老二 2023-08-29 14:57 采纳率: 0%
浏览 10

主函数怎么写,两个文件中

此代码主函数怎么写


```c++
#include <iDA/iDA.h>

using namespace iPlature;
void Step1()
{
    iDA::Connection con; // 创建连接对象
    try
    {

        //连接数据库

        con.Connect(

            "iplature",     // database name数据库名

            "auth",   // user name

            "auth",   // password

            iDA::iDA_Oracle_Client
        );
        printf("We are connected!\n");
        // Disconnect is optional 断开连接可选
         // autodisconnect will ocur in destructor if needed  如果需要 将自动断开连接
        con.Disconnect();
        printf("We are disconnected!\n");
    }
    catch (iDA::Exception &x)

    {
        // Connection::Rollback() 回滚
         // can also throw an exception   抛出异常
         // (if a network error for example), 假如网络错误
         // we will be ready 准备
        try
        {
            // on error rollback changes  错误回滚更该
            con.Rollback();
        }
        catch (iDA::Exception &)
        {

        }

        // print error message  打印错误信息

        printf("%s\n", x.ErrMsg().c_str());

    }

}




```

  • 写回答

2条回答 默认 最新

  • two15 2023-08-29 16:23
    关注
    
    #include <iDA/iDA.h>
    #include<iostream>
    int main()
    {
    Step1();
    system("pause");
    }
    

    这样?

    评论

报告相同问题?

问题事件

  • 创建了问题 8月29日