protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!StringHelper.IsBadChar(Request.QueryString["column_name"])) { txtColumnName.Text = Request.QueryString["column_name"]; string tablename = Request.QueryString["tablename"]; DataTable dt = new BLL.DataBaseHelper().GetShemaColumnName(tablename); if (dt.Rows.Count > 0) { DataView dtv = dt.DefaultView; dtv.RowFilter = string.Format("COLUMN_NAME='{0}'", txtColumnName.Text); if (dtv.Count == 0) { return; } DataRowView drs = dtv[0]; dropType.SelectedValue = "TEXT"; txtDefaultValue.Text = drs["column_default"].ToString(); chkIsNull.Checked = drs["is_nullable"].ToString().ToLower() == "true" ? true : false; txtLength.Text = drs["CHARACTER_MAXIMUM_LENGTH"].ToString(); txtDesc.Text = drs["description"].ToString(); } BindShowType(); } } }
private void BindData() { DataTable dt = new BLL.DataBaseHelper().GetShemaTable(); gvList.DataSource = dt; gvList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (!StringHelper.IsBadChar(Request.QueryString["column_name"])) { txtColumnName.Text = Request.QueryString["column_name"]; string tablename = Request.QueryString["tablename"]; DataTable dt = new BLL.DataBaseHelper().GetShemaColumnName(tablename); if (dt.Rows.Count > 0) { DataView dtv = dt.DefaultView; dtv.RowFilter = string.Format("COLUMN_NAME='{0}'", txtColumnName.Text); if (dtv.Count == 0) return; DataRowView drs = dtv[0]; dropType.SelectedValue = "TEXT"; txtDefaultValue.Text = drs["column_default"].ToString(); chkIsNull.Checked = drs["is_nullable"].ToString().ToLower() == "true" ? true : false; txtLength.Text = drs["CHARACTER_MAXIMUM_LENGTH"].ToString(); txtDesc.Text = drs["description"].ToString(); } BindShowType(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!StringHelper.IsBadChar(Request.QueryString["tablename"])) { string tablename = Request.QueryString["tablename"]; DataTable dt = new BLL.DataBaseHelper().GetShemaColumnName(tablename); DataView dtv = dt.DefaultView; dtv.Sort = "ordinal_position"; gvList.DataSource = dtv; gvList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt1 = new BLL.DataBaseHelper().GetShemaTable(); listTables.DataSource = dt1; listTables.DataBind(); //获取当前模板目录 DataRowView dv = BLL.DataBaseHelper.instance.GetModelView("viewMyWeb", "folder", ""); spCurTemplatePath.InnerText = "~/template/" + dv["folder"].ToString() + "/"; BindData(); } }
protected void listTables_SelectedIndexChanged(object sender, EventArgs e) { string tablename = listTables.SelectedValue; if (tablename != "") { DataTable dt = new BLL.DataBaseHelper().GetShemaColumnName(tablename); DataView dtv = dt.DefaultView; dtv.Sort = "ordinal_position"; ListColumns.DataSource = dtv; ListColumns.DataValueField = "column_name"; ListColumns.DataTextField = "column_name"; ListColumns.DataBind(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { DataBaseHelper dbop = new DataBaseHelper(); try { dbop.CreateTable("U_"+StringHelper.ReplaceBadChar(txtTableName.Text)); lblResult.Text = "操作成功!"; Response.Redirect("DBColumnList.aspx?tablename=U_"+txtTableName.Text.Trim()); } catch { lblResult.Text = "创建失败,可能表已经存在!"; } ////上传文件 //string imageName = UploadFile(); //Dukey.Model.Articles model = new Dukey.Model.Articles(); //model.title = StringHelper.ReplaceBadChar(txtTitle.Text); //model.brief = StringHelper.ReplaceBadChar(txtBrief.Text); //model.contents = txtContent.Value; //model.bid = int.Parse(dropSort.SelectedValue); //model.isshow = chkIsShow.Checked; //DateTime dt = DateTime.Now; //DateTime.TryParse(txtPublishTime.Text, out dt); //model.cur_time = dt; //model.picurl = imageName; //int px = 0; //int.TryParse(txtOrders.Text, out px); //model.px = px; //if (!StringHelper.isNum(Request.QueryString["id"]))//插入新纪录 //{ // BLL.Articles.instance.Add(model); //} //else//更新纪录 //{ // model.id = int.Parse(Request.QueryString["id"]); // BLL.Articles.instance.Update(model); //} }