如何连接到Ctree数据库?

时间:2018-11-30 19:08:59

标签: c# ctree

我正在尝试连接到C树数据库,但是没有任何成功。我在这里(https://social.msdn.microsoft.com/Forums/windows/en-US/902e95f6-17f4-48f3-9320-e391c072a50c/how-to-read-a-ctree-database?forum=winforms找到了这段代码,但是我缺少一些我不知道如何制作的参考。我认为我需要安装驱动程序或引用一些.dll,但我不知道如何。

    static CtreeSqlConnection conn;
    static CtreeSqlCommand cmd;
    static CtreeSqlDataReader rdr;

    // Perform the minimum requirement of logging onto the c-tree Server
    static void Initialize()
    {
        try
        {
            // initialize connection object
            conn = new CtreeSqlConnection();
            conn.ConnectionString =
           "UID=ADMIN;PWD=ADMIN;Database=CtreeSQL;Server=localhost;Service=6597;";
            // initialize command object
            cmd = new CtreeSqlCommand();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.Connection = conn;
            cmd.Transaction = null;
            // connect to server
            conn.Open();
        }
        catch (CtreeSqlException e)
        {
            Handle_Exception(e);
        }
        catch (Exception e)
        {
            Handle_Exception(e);
        }
    }

0 个答案:

没有答案