using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; namespace label_cs { /// <summary> /// label_xml¿¡ ´ëÇÑ ¿ä¾à ¼³¸íÀÔ´Ï´Ù. /// </summary> public class label_xml : System.Web.UI.Page { protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1; protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1; protected System.Data.OleDb.OleDbConnection oleDbConnection1; private void Page_Load(object sender, System.EventArgs e) { // ¿©±â¿¡ »ç¿ëÀÚ Äڵ带 ¹èÄ¡ÇÏ¿© ÆäÀÌÁö¸¦ ÃʱâÈ­ÇÕ´Ï´Ù. Response.ContentEncoding = System.Text.Encoding.Default; DataSet myds; myds = new DataSet("root"); this.oleDbConnection1.Open (); this.oleDbDataAdapter1.Fill (myds,"¹Þ´Â»ç¶÷"); Response.Write("<?xml version='1.0' encoding='euc-kr'?>"); Response.Write (myds.GetXml()); this.oleDbConnection1.Close(); } #region Web Form µðÀÚÀ̳ʿ¡¼­ »ý¼ºÇÑ ÄÚµå override protected void OnInit(EventArgs e) { // // CODEGEN: ÀÌ È£ÃâÀº ASP.NET Web Form µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù. // InitializeComponent(); base.OnInit(e); } /// <summary> /// µðÀÚÀÌ³Ê Áö¿ø¿¡ ÇÊ¿äÇÑ ¸Þ¼­µåÀÔ´Ï´Ù. /// ÀÌ ¸Þ¼­µåÀÇ ³»¿ëÀ» ÄÚµå ÆíÁý±â·Î ¼öÁ¤ÇÏÁö ¸¶½Ê½Ã¿À. /// </summary> private void InitializeComponent() { this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter(); this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand(); this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection(); // // oleDbDataAdapter1 // this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1; this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "Customers", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), new System.Data.Common.DataColumnMapping("CompanyName", "CompanyName"), new System.Data.Common.DataColumnMapping("ContactName", "ContactName"), new System.Data.Common.DataColumnMapping("ContactTitle", "ContactTitle"), new System.Data.Common.DataColumnMapping("Address", "Address"), new System.Data.Common.DataColumnMapping("City", "City"), new System.Data.Common.DataColumnMapping("Region", "Region"), new System.Data.Common.DataColumnMapping("PostalCode", "PostalCode"), new System.Data.Common.DataColumnMapping("Country", "Country"), new System.Data.Common.DataColumnMapping("Phone", "Phone"), new System.Data.Common.DataColumnMapping("Fax", "Fax")})}); // // oleDbSelectCommand1 // this.oleDbSelectCommand1.CommandText = "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region," + " PostalCode, Country, Phone, Fax FROM Customers Where City like '%" + Request.QueryString["City"].ToString() + "%'"; this.oleDbSelectCommand1.Connection = this.oleDbConnection1; // // oleDbConnection1 // this.oleDbConnection1.ConnectionString = @"User ID=sa;Tag with column collation when possible=False;Data Source=hwabong;Password=cab123;Initial Catalog=NWind;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=True;Provider=""SQLOLEDB.1"";Workstation ID=HWABONG;Use Encryption for Data=False;Packet Size=4096"; this.Load += new System.EventHandler(this.Page_Load); } #endregion } }