示例#1
0
 private static string SaveImportTable(DataSet ds, string CompanyID, string ImportTableType)
 {
     if (ds.Tables[0].Rows.Count < 1)
     {
         return("文件没有内容");
     }
     return(FieldBLL.InsertByDataSet(ds, CompanyID, ImportTableType));
 }
示例#2
0
        public static void UpdateTbKey(string CompanyID, string tableType, string newKey)
        {
            DataSet   ds        = HttpContext.Current.Cache[Tools.GetCashName(CompanyID, tableType)] as DataSet;
            string    tableName = CompanyDAL.GetTableName(CompanyID, tableType);
            DataTable dt        = ds.Tables[0];
            string    newKeyID  = dt.Select("FieldName='" + newKey + "'")[0]["ID"].ToString();

            DataRow[] drsTbkey = dt.Select("FieldName='tbKey'");
            if (drsTbkey.Length == 0)
            {
                DataHelper.ExecuteQuerys(string.Format(" EXEC sp_rename '{0}.{1}', 'tbKey', 'column' ", tableName, newKey));
                FieldBLL.UpdateField(newKeyID, "tbKey", CompanyID, tableType);
            }
            else
            {
                string oldKeyID     = drsTbkey[0]["ID"].ToString();
                string oldFieldName = "tb_" + DateTime.Now.Ticks.ToString();
                DataHelper.ExecuteQuerysArray(new string[] { string.Format("EXEC sp_rename '{0}.tbKey', '{1}', 'column' ", tableName, oldFieldName), string.Format("EXEC sp_rename '{0}.{1}', 'tbKey', 'column' ", tableName, newKey) });
                FieldBLL.UpdateField(oldKeyID, oldFieldName, CompanyID, tableType);
                FieldBLL.UpdateField(newKeyID, "tbKey", CompanyID, tableType);
            }
        }