当前位置: 首页 > 工具软件 > JCas > 使用案例 >

.Net通过Com组件访问Jcas数据库服务

归俊捷
2023-12-01
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using JcasDbCom10Lib;
using ConfigHelp;
using DMSSYSCOMLib;

namespace ComRefWin
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DmsSysEnv dmsSysEnv = new DmsSysEnvClass();

            dmsSysEnv.LoadSysEnv("");

            JcasDbHelper jcasDbHelper = new JcasDbHelperClass();

            Config config = new ConfigClass();

            string SessionKey = config.GetSessionKey("ComRefWin.exe");

            jcasDbHelper.SetSessionKey(SessionKey);

            JcasDatabase jcasDatabase = jcasDbHelper.CreateDatabase3(false, "http://10.158.51.52:8080/config.pmssd.xml", "db/pubdb");

            JcasRecordset jcasRecordset =jcasDatabase.Execute2("select * from dual",false);

            MessageBox.Show(jcasRecordset.GetFieldCount().ToString());
        }
    }
}

转载于:https://www.cnblogs.com/AlexJones/archive/2010/10/09/1846255.html

 类似资料: