예제 #1
0
        public void AddInformation()//输入默认元件库初始信息
        {
            string sql = @"select * from ComponentsDb";

            m_connectToAccess = new ConnectToAccess(deFaultpath, "CavityLibrary");
            m_connectToAccess.GetAddInformation(sql, m_editCavityLibrary.lv1, "IndexName", "Name");
        }
 private void btnscan_Click(object sender, EventArgs e)
 {
     if (this.lv1.SelectedItems.Count != 1)
     {
         MessageBox.Show("请选择要浏览的元件类型");
     }
     else
     {
         string indexname = this.lv1.SelectedItems[0].SubItems[0].Text.ToString();
         string sql       = @"select * from " + indexname;
         m_connectToAccess = new ConnectToAccess(deFaultpath, "CavityLibrary");
         m_connectToAccess.GetAddInformation(sql, lv2, "编码", "索引编号");
     }
 }
        private void btnbrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == DialogResult.OK)
            {                                                                                  //显示浏览文件夹的窗体
                string filepath = fbd.SelectedPath;                                            //返回所选中文件夹所在的路径
                tb1.Text = filepath;                                                           //将文件夹的路径显示在界面的指定文本框中
                System.IO.DirectoryInfo pathname = new System.IO.DirectoryInfo(filepath);      //为了获得该路径的根目录
                string filename = pathname.Name;                                               //获得该根目录下文件夹的名称
                m_connectToAccess = new ConnectToAccess(filepath, filename);
                string sql = @"select * from ComponentsDb";
                m_connectToAccess.GetAddInformation(sql, lv1, "IndexName", "Name");
            }
        }