哈哈~~~跑题了~~~不过我说过暂不在其他版面发主帖~~~ 同时也是我给我的两位CVI老师交的CVI菜鸟毕业水文... #include "MSDATGRD.h"//数据库表格控件头文件 #include "ADODB.h"//ADO2.7头文件 #include <cvirte.h> #include <cviauto.h> #include "ADOToolkit.h"//菜农封装的ADO #include <userint.h> #include "test.h" //ADO测试程序头文件 #include <formatio.h>
static int panelHandle; static CAObjHandle DataGrid1; static CAObjHandle DataGrid2; int main (int argc, char *argv[]) { static HRESULT status; int DataBase, Table1, Table2; CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED); if (InitCVIRTE (0, argv, 0) == 0) return -1; /* out of memory */ if ((panelHandle = LoadPanel (0, "test.uir", PANEL)) < 0) return -1; GetObjHandleFromActiveXCtrl (panelHandle, PANEL_DATAGRID_1, &DataGrid1);//数据库表格控件1 GetObjHandleFromActiveXCtrl (panelHandle, PANEL_DATAGRID_2, &DataGrid2);//数据库表格控件2 ADO_DataBaseInit ();//ADO初始化 status = ADO_OpenDataBase ("DSN=SampleDatabase", &DataBase);//打开数据库 if (status == S_OK) { status = ADO_OpenTable ("SELECT * FROM [myTable]", &Table1);//用SQL语句打开表1 if (status == S_OK) { status = ADO_OpenTable ("myOtherTable", &Table2);//直接打开表2 if (status == S_OK) { ADO_DataGrid (DataGrid1, Table1);//将Table1绑定到DataGrid1 ADO_DataGrid (DataGrid2, Table2);//将Table1绑定到DataGrid1 } } } DisplayPanel (panelHandle); RunUserInterface (); ADO_DataBaseQuit ();//ADO退出(自动关闭数据库及表和释放系统资源) DiscardPanel (panelHandle); return 0; }
哈哈~~~准备进一步完善,肯定比$598的SQL Toolkit好玩,快捷~~~
刚刚做CVI的函数面板菜鸟,准备继续完善.
要没有此功能,真该要倒塌了~~~
相关链接:http://www.**/blog/hotpower/23169/message.aspx |