using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; namespace label_cs { /// <summary> /// label_xml_soap¿¡ ´ëÇÑ ¿ä¾à ¼³¸íÀÔ´Ï´Ù. /// </summary> public class label_xml_soap : System.Web.Services.WebService { public label_xml_soap() { //CODEGEN: ÀÌ È£ÃâÀº ASP.NET À¥ ¼­ºñ½º µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù. InitializeComponent(); } private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1; private System.Data.OleDb.OleDbCommand oleDbSelectCommand1; private System.Data.OleDb.OleDbConnection oleDbConnection1; #region ±¸¼º ¿ä¼Ò µðÀÚÀ̳ʿ¡¼­ »ý¼ºÇÑ ÄÚµå //À¥ ¼­ºñ½º µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù. private IContainer components = null; /// <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")})}); // // 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"; } /// <summary> /// »ç¿ë ÁßÀÎ ¸ðµç ¸®¼Ò½º¸¦ Á¤¸®ÇÕ´Ï´Ù. /// </summary> protected override void Dispose( bool disposing ) { if(disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } #endregion // À¥ ¼­ºñ½º ¿¹Á¦ // HelloWorld() ¿¹Á¦ ¼­ºñ½º´Â Hello World¶ó´Â ¹®ÀÚ¿­À» ¹ÝȯÇÕ´Ï´Ù. // ºôµåÇÏ·Á¸é ´ÙÀ½ ÁÙÀÇ ÁÖ¼® 󸮸¦ Á¦°ÅÇϰí ÀúÀåÇÑ ÈÄ ÇØ´ç ÇÁ·ÎÁ§Æ®¸¦ ºôµåÇÕ´Ï´Ù. // ÀÌ À¥ ¼­ºñ½º¸¦ Å×½ºÆ®ÇÏ·Á¸é <F5> ۸¦ ´©¸¨´Ï´Ù. // [WebMethod] // public string HelloWorld() // { // return "Hello World"; // } [WebMethod] public System.Xml.XmlDocument Get_Customers(string City ) { System.Xml.XmlDocument returnXML; DataSet myds; myds = new DataSet("root"); returnXML = new System.Xml.XmlDocument() ; this.oleDbConnection1.Open(); // // oleDbSelectCommand1 // this.oleDbSelectCommand1.CommandText = "SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region," + " PostalCode, Country, Phone, Fax FROM Customers Where City like '%" + City + "%'"; this.oleDbSelectCommand1.Connection = this.oleDbConnection1; this.oleDbDataAdapter1.Fill(myds,"¹Þ´Â»ç¶÷"); returnXML.LoadXml(myds.GetXml()); this.oleDbConnection1.Close (); return returnXML; } } }