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

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());
        }
    }
}

posted @ 2010-10-09 06:01  AlexJones  阅读(211)  评论(0编辑  收藏  举报