public DbToScript(string longservername, string dbname) { InitializeComponent(); DbName = dbname; dsb = ObjHelper.CreatDsb(longservername); dbobj = ObjHelper.CreatDbObj(longservername); this.lblServer.Text = longservername; List <string> dblist = dbobj.GetDBList(); if (dblist != null) { if (dblist.Count > 0) { foreach (string name in dblist) { this.cmbDB.Items.Add(name); } } } //DataTable dt = dbobj.GetDBList(); //if (dt != null) //{ // foreach (DataRow row in dt.Rows) // { // this.cmbDB.Items.Add(row["name"].ToString()); // } //} this.btn_Creat.Enabled = false; this.cmbDB.Text = DbName; }
private void DbToWord_Load(object sender, System.EventArgs e) { string mastedb = "master"; switch (dbobj.DbType) { case "SQL2000": case "SQL2005": mastedb = "master"; break; case "Oracle": case "OleDb": mastedb = dbset.DbName; break; case "MySQL": mastedb = "mysql"; break; } if ((dbset.DbName == "") || (dbset.DbName == mastedb)) { List <string> dblist = dbobj.GetDBList(); if (dblist != null) { if (dblist.Count > 0) { foreach (string dbname in dblist) { this.cmbDB.Items.Add(dbname); } } } } else { this.cmbDB.Items.Add(DbName); } this.btn_Creat.Enabled = false; this.cmbDB.Text = DbName; }
public DbToScript(string longservername) { InitializeComponent(); dsb = ObjHelper.CreatDsb(longservername); dbobj = ObjHelper.CreatDbObj(longservername); int s = longservername.IndexOf("("); string server = longservername.Substring(0, s); this.lblServer.Text = server; List <string> dblist = dbobj.GetDBList(); if (dblist != null) { if (dblist.Count > 0) { foreach (string dbname in dblist) { this.cmbDB.Items.Add(dbname); } } } //DataTable dt = dbobj.GetDBList(); //if (dt != null) //{ // foreach (DataRow row in dt.Rows) // { // string dbname = row["name"].ToString(); // this.cmbDB.Items.Add(dbname); // } //} this.btn_Creat.Enabled = false; if (cmbDB.Items.Count > 0) { this.cmbDB.SelectedIndex = 0; } }