private void b_ok_Click(object sender, EventArgs e) { DbDto dbdto = new DbDto { DataSource = cb_DataSource.Text, InitialCatalog = (string)cb_dblist.SelectedValue, UserID = t_user.Text, Password = t_pwd.Text }; CrawlerPro.Common.XmlHelper.CreateConfig(dbdto); Visible = false; Invoke(new MethodInvoker(delegate() { load.Visible = false; })); new MainForm().Show(); }
public static void CreateConfig(DbDto dto) { XmlDocument xmldoc = new XmlDocument(); XmlDeclaration xmldecl; xmldecl = xmldoc.CreateXmlDeclaration("1.0", "utf-8", null); xmldoc.AppendChild(xmldecl); XmlElement xmlelem = xmldoc.CreateElement("", "configuration", ""); xmldoc.AppendChild(xmlelem); XmlNode root = xmldoc.SelectSingleNode("configuration"); XmlElement xe1 = xmldoc.CreateElement("Setting"); XmlElement xesub1 = xmldoc.CreateElement("DBConn"); xesub1.SetAttribute("value", string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", dto.DataSource, dto.InitialCatalog, dto.UserID, dto.Password)); xe1.AppendChild(xesub1); root.AppendChild(xe1); xmldoc.Save(AppDomain.CurrentDomain.BaseDirectory + "\\App.config"); }
public JsonResult GetField([FromBody] DbDto loadDbDto) { var res = _generateService.GetField(loadDbDto); return(Json(new { code = 0, msg = "success", count = res.Count, data = res })); }
public ApiResult <List <string> > GetTable([FromBody] DbDto loadDbDto) { return(_generateService.GetTable(loadDbDto)); }