public void CreateObject(ConnectionInfo conn, string dbName, string tableName, ColumnInfo column) { SqlConnection sqlCon = Provider.getMssqlConn(conn); IColumnManage<SqlConnection> columnManage = DBFactory.CreateColumnManage<SqlConnection>(); columnManage.AddColumn(sqlCon, dbName, tableName, column); }
//添加列 protected void Jqgrid1_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e) { ColumnInfo column = new ColumnInfo(); column .Name = e.RowData["Name"]; column .Typestring = e.RowData["Typestring"]; if (column .Isnullable == "on") { column.Isnullable = "null"; } else { column.Isnullable = "not null"; } manage.CreateObject(getConnInfo(), dbName, tableName, column); }
//编辑列 protected void Jqgrid1_RowEditing(object sender, Trirand.Web.UI.WebControls.JQGridRowEditEventArgs e) { ColumnInfo column = new ColumnInfo(); column.Name = e.RowData["Name"]; column.Typestring = e.RowData["Typestring"]; if (e.RowData["Isnullable"] == "on") { column.Isnullable = "null"; } else { column.Isnullable = "not null"; } //若修改了列名 if (e.RowKey != e.RowData["Name"].ToString ()) { manage.RenameObject(getConnInfo(), e.RowKey, e.RowData["Name"], dbName, tableName); } manage.UpdateColumn(getConnInfo(), dbName, tableName, column); }