소스는 아래와 같습니다.
XML Data를 읽어와 DataSet으로....
Web에서 사용하던 내용을 CS 단으로 적용 시킨 내용 입니다.
프로그램 실행 결과입니다.
프로그램 소스 코드 입니다.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Xml;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
string currentPage = "1"; //현재 페이지
string countPerPage = "1000"; //1페이지당 출력 갯수
string confmKey = "TESTJUSOGOKR"; //테스트 Key
string keyword = string.Empty;
string apiurl = string.Empty;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
keyword = textBox1.Text.Trim();
apiurl = "http://www.juso.go.kr/addrlink/addrLinkApi.do?currentPage=" + currentPage + "&countPerPage=" + countPerPage + "&keyword=" + keyword + "&confmKey=" + confmKey;
textBox2.Text = apiurl+"\r\n";
WebClient wc = new WebClient();
XmlReader read = new XmlTextReader(wc.OpenRead(apiurl));
DataSet ds = new DataSet();
ds.ReadXml(read);
dataGridView2.DataSource = ds.Tables[0];
DataRow[] rows = ds.Tables[0].Select();
textBox2.Text += rows[0]["totalCount"].ToString();
if (rows[0]["totalCount"].ToString() != "0")
{
dataGridView1.DataSource = ds.Tables[1];
}
}
catch (Exception ex)
{
}
}
}
}

