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
{
///
/// label_xml_reader¿¡ ´ëÇÑ ¿ä¾à ¼³¸íÀÔ´Ï´Ù.
///
public class label_xml_reader : 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;
this.oleDbConnection1.Open ();
System.Data.OleDb.OleDbDataReader myReader;
myReader = this.oleDbSelectCommand1.ExecuteReader();
Response.Write("");
Response.Write("" + "\n");
while(myReader.Read())
{
Response.Write(" <¹Þ´Â»ç¶÷>\n" );
Response.Write(" <¿ìÆí¹øÈ£>" + myReader["PostalCode"].ToString() + "¿ìÆí¹øÈ£>");
Response.Write(" <ÁÖ¼Ò>" + myReader["City"].ToString() + " " + myReader["Address"].ToString() + "ÁÖ¼Ò>");
Response.Write(" <ȸ»ç¸í>" + myReader["CompanyName"].ToString() + "ȸ»ç¸í>");
Response.Write(" <´ã´çÀÚ¸í>" + myReader["ContactName"].ToString() + "´ã´çÀÚ¸í>");
Response.Write(" <´ã´çÀÚÁ÷Ã¥¸í>" + myReader["ContactTitle"].ToString() + "´ã´çÀÚÁ÷Ã¥¸í>");
Response.Write(" ¹Þ´Â»ç¶÷>\n" );
}
Response.Write("" + "\n");
// µ¥ÀÌÅÍ º£À̽º ´Ý±â
myReader.Close() ;
this.oleDbConnection1.Close() ;
}
#region Web Form µðÀÚÀ̳ʿ¡¼ »ý¼ºÇÑ ÄÚµå
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: ÀÌ È£ÃâÀº ASP.NET Web Form µðÀÚÀ̳ʿ¡ ÇÊ¿äÇÕ´Ï´Ù.
//
InitializeComponent();
base.OnInit(e);
}
///
/// µðÀÚÀÌ³Ê Áö¿ø¿¡ ÇÊ¿äÇÑ ¸Þ¼µåÀÔ´Ï´Ù.
/// ÀÌ ¸Þ¼µåÀÇ ³»¿ëÀ» ÄÚµå ÆíÁý±â·Î ¼öÁ¤ÇÏÁö ¸¶½Ê½Ã¿À.
///
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
}
}