using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Xml; using System.Xml.Xsl; using System.IO; using System.Data.SqlClient; using System.Xml.XPath; public partial class _Default : System.Web.UI.Page ... { DataSet Myds; protected void Page_Load(object sender, EventArgs e) ...{ tex1.Focus(); GetData(); XmlDataDocument xmlDoc = new XmlDataDocument(Myds); //XslCompiledTransform xslTran = new XslCompiledTransform(); XslTransform xslTran = new XslTransform(); xslTran.Load(Server.MapPath("DWHTables.xsl")); Xml1.Document = xmlDoc; Xml1.Transform = xslTran; } private void GetData() ...{ try ...{ //string Class_id = Request.Url.ToString(); //string[] sArray = Class_id.Split('='); //Class_id = sArray[1]; //Session["Id"] = Class_id.ToString().Trim(); string strConn =ConfigurationManager.AppSettings["user1"]; SqlConnection myCn = new SqlConnection(strConn); //SqlDataAdapter MyCmd = new SqlDataAdapter("DWH_TABLES_OUT",myCn); SqlDataAdapter MyCmd = new SqlDataAdapter("dwh_sp_GetTablelist", myCn); Myds = new DataSet("Myds"); try ...{ myCn.Open(); MyCmd.SelectCommand.CommandType = CommandType.StoredProcedure; MyCmd.SelectCommand.CommandTimeout = 600; //MyCmd.SelectCommand.Parameters.Add("@class1",System.Data.OleDb.OleDbType.SmallInt).Value=Convert.ToInt16(Class_id); MyCmd.Fill(Myds); Myds.Tables[0].TableName = "Tables"; // Myds.Tables[1].TableName = "Pages"; Session["myds"] = Myds; } catch (Exception ex) ...{ Response.Write("<script language = jscript>alert('「" + ex.Message.Replace("'", "") + "」');window.history.go(-1);</script>"); return; } finally ...{ MyCmd.Dispose(); myCn.Close(); } } catch (Exception ex) ...{ Response.Write("<script language = jscript>alert('「" + ex.Message.Replace("'", "") + "」');window.history.go(-1);</script>"); return; } } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) ...{ if (tex1.Text == "") ...{ Response.Write("<script language='javascript'>alert('This is null! Please retry...');window.history.go(-1);</script>"); return; } else ...{ if (RadioButtonList1.Items[0].Selected == true) ...{ string strConn = ConfigurationManager.AppSettings["user1"]; SqlConnection myCn = new SqlConnection(strConn); SqlDataAdapter MyCmd = new SqlDataAdapter("dwh_sp_GetTablelist", myCn); Myds = new DataSet("Myds"); try ...{ myCn.Open(); MyCmd.SelectCommand.CommandType = CommandType.StoredProcedure; MyCmd.SelectCommand.CommandTimeout = 600; MyCmd.SelectCommand.Parameters.AddWithValue("@table_name", System.Data.OleDb.OleDbType.VarChar).Value = this.tex1.Text.ToString().Trim(); MyCmd.SelectCommand.Parameters.AddWithValue("@flag", System.Data.OleDb.OleDbType.Integer).Value = 0; MyCmd.Fill(Myds); Myds.Tables[0].TableName = "Tables"; // ds.Tables[1].TableName = "Pages"; //Session["myds"] = Myds; XmlDataDocument xmlDoc = new XmlDataDocument(Myds); //XslCompiledTransform xslTran = new XslCompiledTransform(); XslTransform xslTran = new XslTransform(); xslTran.Load(Server.MapPath("DWHTables.xsl")); Xml1.Document = xmlDoc; Xml1.Transform = xslTran; } catch (Exception ex) ...{ Response.Write("<script language = jscript>alert('「" + ex.Message.Replace("'", "") + "」');window.history.go(-1);</script>"); return; } finally ...{ MyCmd.Dispose(); myCn.Close(); } } else ...{ string strConn = ConfigurationManager.AppSettings["user1"]; SqlConnection myCn = new SqlConnection(strConn); SqlDataAdapter MyCmd = new SqlDataAdapter("dwh_sp_GetTablelist", myCn); Myds = new DataSet("Myds"); try ...{ myCn.Open(); MyCmd.SelectCommand.CommandType = CommandType.StoredProcedure; MyCmd.SelectCommand.CommandTimeout = 600; MyCmd.SelectCommand.Parameters.AddWithValue("@table_name", System.Data.OleDb.OleDbType.VarChar).Value = this.tex1.Text.ToString().Trim(); MyCmd.SelectCommand.Parameters.AddWithValue("@flag", System.Data.OleDb.OleDbType.Integer).Value = 1; MyCmd.Fill(Myds); Myds.Tables[0].TableName = "Tables"; // ds.Tables[1].TableName = "Pages"; //Session["myds"] = Myds; XmlDataDocument xmlDoc = new XmlDataDocument(Myds); //XslCompiledTransform xslTran = new XslCompiledTransform(); XslTransform xslTran = new XslTransform(); xslTran.Load(Server.MapPath("DWHTables.xsl")); Xml1.Document = xmlDoc; Xml1.Transform = xslTran; } catch (Exception ex) ...{ Response.Write("<script language = jscript>alert('「" + ex.Message.Replace("'", "") + "」');window.history.go(-1);</script>"); return; } finally ...{ MyCmd.Dispose(); myCn.Close(); } } } } }