protected void DBTableDownList2_SelectedIndexChanged(object sender, EventArgs e) { if (this.DbTableDownList2.SelectedIndex <= 0) { this.Span1.Visible = false; } else { DataTable table = new DataTable(); string dbtype = this.Dbtype; if (dbtype != null) { if (!(dbtype == "sql_sysquery")) { if (dbtype == "sql_outquery") { table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Sql); } else if (dbtype == "ole_read") { table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Ole); } else if (dbtype == "odbc_read") { table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Odbc); } else if (dbtype == "orc_read") { table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, XmlManage.ReadFileNode(this.xmlfilepath, "root/LabelDataSource"), DataSourceType.Oracle); } } else { table = LabelManage.GetSchemaTable(this.DbTableDownList2.SelectedValue, string.Empty, DataSourceType.None); } } this.DbFieldDownList2.DataSource = table; this.DbFieldList2.DataSource = table; this.DbFieldDownList2.DataTextField = "ColumnName"; this.DbFieldDownList2.DataValueField = "ColumnName"; this.DbFieldDownList2.DataBind(); this.DbFieldList2.DataTextField = "ColumnName"; this.DbFieldList2.DataValueField = "ColumnName"; this.DbFieldList2.DataBind(); this.Span1.Visible = true; } }
protected static DataTable GetDataBaseSchema(string dtype, string xpath, string tablename) { switch (dtype) { case "sql_sysquery": return(LabelManage.GetSchemaTable(tablename, string.Empty, DataSourceType.None)); case "sql_outquery": return(LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Sql)); case "ole_read": return(LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Ole)); case "odbc_read": return(LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Odbc)); case "orc_read": return(LabelManage.GetSchemaTable(tablename, XmlManage.ReadFileNode(xpath, "root/LabelDataSource"), DataSourceType.Oracle)); } return(null); }