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 CreatDBProc() { string projectname = this.txtProjectName.Text; string snamespace = this.txtNameSpace.Text; string snamespace2 = this.txtNameSpace2.Text; string classname = this.txtClassName.Text; string procPrefix = this.txtProcPrefix.Text; string procTabname = this.txtTabname.Text; bool Maxid = this.chk_DB_GetMaxID.Checked; bool Exists = this.chk_DB_Exists.Checked; bool Add = this.chk_DB_Add.Checked; bool Update = this.chk_DB_Update.Checked; bool Delete = this.chk_DB_Delete.Checked; bool GetModel = this.chk_DB_GetModel.Checked; bool List = this.chk_DB_GetList.Checked; Maticsoft.IDBO.IDbScriptBuilder dsb = ObjHelper.CreatDsb(servername); dsb.DbName = dbname; dsb.TableName = procTabname;// tablename; dsb.ProjectName = projectname; dsb.ProcPrefix = procPrefix; dsb.Keys = GetKeyFields(); dsb.Fieldlist = GetFieldlist(); string strProc = dsb.GetPROCCode(Maxid, Exists, Add, Update, Delete, GetModel, List); SettxtContent("SQL", strProc); }
//数据库脚本 private void CreatDBScript() { this.Cursor = System.Windows.Forms.Cursors.WaitCursor; Maticsoft.IDBO.IDbScriptBuilder dsb = ObjHelper.CreatDsb(servername); dsb.Fieldlist = GetFieldlist(); string strScript = dsb.CreateTabScript(dbname, tablename); SettxtContent("SQL", strScript); this.Cursor = System.Windows.Forms.Cursors.Default; }
public DataExport(string longservername, string dbname) { InitializeComponent(); DbName = dbname; dbset = Maticsoft.CmConfig.DbConfig.GetSetting(longservername); dbobj = Maticsoft.DBFactory.DBOMaker.CreateDbObj(dbset.DbType); dbobj.DbConnectStr = dbset.ConnectStr; cb = new Maticsoft.CodeBuild.CodeBuilders(dbobj); dsb = Maticsoft.DBFactory.DBOMaker.CreateScript(dbset.DbType);// ObjHelper.CreatDsb(longservername); this.lblServer.Text = dbset.Server; }
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; } }