public ActionResult EditColumn(string tableName, SqliteDBHelper.ColumnInfo ct) { try { var columns = new List <SqliteDBHelper.ColumnInfo>(); var clts = SqliteDBHelper.GetColumnInfos(tableName); if (clts != null && clts.Count > 0) { foreach (var item in clts) { if (item.Ordinal == ct.Ordinal) { columns.Add(ct); } else { columns.Add(item); } } } columns = columns.OrderBy(b => b.Ordinal).ToList(); SqliteDBHelper.AlterColumns(tableName, columns); } catch { } return(Redirect("/Manager/SqliteDataBase/EditTable/" + tableName)); }
/// <summary> /// 编辑列 /// </summary> /// <param name="id"></param> /// <param name="columnName"></param> /// <returns></returns> public ActionResult EditColumn(string id, string columnName) { SqliteDBHelper.ColumnInfo ct = new SqliteDBHelper.ColumnInfo(); ViewBag.TableName = id; ViewBag.ColumnName = columnName; try { var clts = SqliteDBHelper.GetColumnInfos(id); ct = clts.Where(b => b.Name == columnName).First(); } catch { } return(View(ct)); }
/// <summary> /// 编辑表 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult EditTable(string id) { ViewBag.TableName = id; return(View(SqliteDBHelper.GetColumnInfos(id))); }