C语言调用powerBuilder开发数据库
来源:互联网 发布:c语言volatile关键字 编辑:程序博客网 时间:2024/05/16 10:07
C语言编写数据库系统不方便,可以使用权PBNI接口来操作powerbuilder,开发数据库轻松。
// pbtest.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "stdio.h"typedef PBXEXPORT PBXRESULT (*P_PB_GetVM)(IPB_VM** vm);int main(int argc, char* argv[]){ IPB_Session* session; IPB_VM* pbvm = NULL; //Load the PowerBuilder VM module HINSTANCE hinst = LoadLibrary("pbvm90.dll"); if ( hinst== NULL) return 0; fprintf(stderr, "Loaded PBVM successfully\n"); P_PB_GetVM getvm = (P_PB_GetVM)GetProcAddress (hinst,"PB_GetVM"); if (getvm == NULL) return 0; getvm(&pbvm); if (pbvm == NULL) return 0; LPCTSTR LibList[] = {"genapp.dll"}; if ( pbvm->CreateSession("genapp", LibList, 1, &session) != PBX_OK ) { fprintf(stderr, "Error in CreateSession\n"); return 1; } fprintf(stderr, "Created session successfully\n"); pbgroup group = session->FindGroup("nvo_mult", pbgroup_userobject); if (group == NULL) return 0; // Now find the class nvo_mult in the group pbclass cls = session->FindClass(group,"nvo_mult"); if (cls == NULL) return 0; // Create an instance of the PowerBuilder object pbobject pbobj = session->NewObject(cls); PBCallInfo ci; // To call the class member function f_mult, // pass its signature as the last argument // to GetMethodID pbmethodID mid = session->GetMethodID(cls, "f_mult", PBRT_FUNCTION, "III"); // Initialize call info structure based on method ID session->InitCallInfo(cls, mid, &ci); ci.pArgs-> GetAt(0)->SetInt(10); ci.pArgs-> GetAt(1)->SetInt(20); try { session->InvokeObjectFunction(pbobj, mid, &ci); // Was PB exception thrown? if (session->HasExceptionThrown()) { // Handle PB exception session->ClearException(); } } catch (...) { // Handle C++ exception } // Get the return value and print it to the console pbint ret = ci.returnValue->GetInt(); fprintf(stderr, "The product of 123 and 45 is %i\n", ret); session->FreeCallInfo(&ci); //delete &ci; // Release session session->Release(); return 0; FreeLibrary(hinst);}
这个是帮助文档中的的例子,放在这里做个笔录.
- C语言调用powerBuilder开发数据库
- powerbuilder调用数据库存储过程
- C语言调用数据库
- PowerBuilder 编绎成C语言源码
- 用Powerbuilder开发WEB数据库
- c语言调用Mysql数据库
- 利用POWERBUILDER开发数据库的WEB查询
- C语言MYSQL数据库开发入门
- 基于C语言的DB2数据库开发
- PowerBuilder 调用动态库
- PowerBuilder 调用http接口
- PowerBuilder的语言基础
- C语言可以直接或间接调用数据库吗?
- 使用C语言调用mysql数据库编程实战以及技巧
- PowerBuilder数据库配置方法
- PowerBuilder数据库配置方法
- 数据库powerbuilder使用
- PowerBuilder怎样连接数据库
- Web.xml解读 <context-param>
- 不要向外暴露原始数据
- Myeclipse下debug调试总结
- 用rand()和srand()产生为随机数的方法总结,
- JAVA 笔记
- C语言调用powerBuilder开发数据库
- BOA 服务器
- disk image(磁盘镜像)
- 比别人过得好就是幸福吗
- IT项目经理应该做什么
- 表格细边框
- 开源项目之Splayer 射手影音播放器
- android adb shell:unknown host service
- 树状数组