zoukankan      html  css  js  c++  java
  • C#中检测access mdb 版本

    const int VERSION_STRING_SIZE = 24;
            const int JET_2_VERSION_NUMBER_START = 1;
            const int JET_VERSION_NUMBER_START = 21;
            const int LENGTH = 1;



    FileStream fs = new FileStream(textBox1.Text, FileMode.Open, FileAccess.Read, FileShare.Read);
                BinaryReader br = new BinaryReader(fs);

                string str = new string(br.ReadChars(VERSION_STRING_SIZE));
                MessageBox.Show(str);

                if (str.Substring(JET_2_VERSION_NUMBER_START-1, LENGTH) == string.Format("{0}", (char)1))
                    MessageBox.Show("Microsoft Access 2");
                else if (str.Substring(JET_VERSION_NUMBER_START-1, LENGTH) == string.Format("{0}", (char)0))
                    MessageBox.Show("Microsoft Access 97");
                else if (str.Substring(JET_VERSION_NUMBER_START-1, LENGTH) == string.Format("{0}", (char)1))
                    MessageBox.Show("Microsoft Access 2000/2002");
                else
                    MessageBox.Show("no");        // maybe it's 2007
                br.Close();
                fs.Close();

  • 相关阅读:
    第4章 函数
    第3章 文件处理和函数
    第2章 数据类型
    第 8章 面向对象补充和网络编程
    第7章 面向对象
    第6章 常用模块
    第 5 章 函数的补充和模块加载
    git 使用命令提交文件
    jquery 读取本地json文件数据
    mpvue 封装api请求接口
  • 原文地址:https://www.cnblogs.com/margiex/p/1155129.html
Copyright © 2011-2022 走看看