public static void ImportField() { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string sql = "select * from domaincode"; RelationSqlServerUtility rsql = new RelationSqlServerUtility(); string insertsql = "insert into RField(old,new) values('{0}','{1}')"; DataSet ds = isql.ExecuteSqlDataSet(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.Field field = new CY.CSTS.Core.Business.Field(); field.FieldName = ds.Tables[0].Rows[i][1].ToString(); field.Save(); rsql.ExecuteSql(string.Format(insertsql, ds.Tables[0].Rows[i][0].ToString(), field.Id)); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string result = string.Empty; if (context.Request.Params["namecontent"] == null) { result = "{success:false,msg:'名称不能为空'}"; } else { try { string namecontent = context.Request.Params["namecontent"].ToString(); CY.CSTS.Core.Business.Field field = new CY.CSTS.Core.Business.Field(); field.FieldName= namecontent; field.Save(); result = "{success:true}"; } catch (Exception ex) { result = "{success:false,msg:'" + ex.Message + "'}"; } } context.Response.Write(result); }