private void btnGetTable_Click(object sender, EventArgs e) { SchemaData schemaData = new SchemaData(); var result = schemaData.GetTableData(); SetLog("讀取 Schema.."); treeView1.Nodes[0].Text = frmORMappingWindow.ConnectionInfo.Initial_Catalog; SetLog(string.Format("讀取資料庫 {0}..", frmORMappingWindow.ConnectionInfo.Initial_Catalog)); treeView1.Nodes[0].Nodes.Clear(); foreach (var schema in result) { TreeNode node = new TreeNode(schema.SCHEMA_Field03); treeView1.Nodes[0].Nodes.Add(node); } SetLog("讀取資料表完成."); treeView1.ExpandAll(); }
private void GetInitialCatalogData() { try { SetConnectionInfo(true); SchemaData schemaData = new SchemaData(); var result = schemaData.GetInitialCatalogData(); cbInitialCatalog.DisplayMember = "SCHEMA_Field02"; cbInitialCatalog.ValueMember = "SCHEMA_Field01"; cbInitialCatalog.DataSource = result.ToList(); } catch (Exception ex) { MessageBox.Show(string.Format("取得資料庫名稱時發生錯誤. SysInfo={0}", ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }