<?xml version="1.0" encoding="EUC-KR" ?>
<%
Dim objxml
Dim nodeCrs
Dim rs
Dim DBCon
Dim strConn
Dim strQry
' DB 접속
strConn = strConn&"Provider=SQLOLEDB.1;Persist Security Info=True;"
strConn = strConn&"Data Source=;" ' Server Name
strConn = strConn&"User ID=;" ' User ID
strConn = strConn&"Password=;" ' User Password
strConn = strConn&"Initial Catalog=;" ' DataBase
Set DBCon = Server.CreateObject("ADODB.Connection")
DBCon.Open strConn
' XML DOM 객체 생성
Set objxml = Server.CreateObject("Msxml2.DOMDocument")
Set nodeCourses = objxml.CreateElement("courses")
objxml.AppendChild(nodeCourses)
szQry = "select crs_idx, crs_nm, edu_sv_nm, regdate from tb_course"
Set rs = DBCon.Execute(szQry)
Do until rs.EOF
db_crs_idx = rs(0)
db_crs_nm = rs(1)
db_edu_sv_nm= rs(2)
db_regdate = rs(3)
Set nodeCourse = objxml.CreateElement("course")
nodeCourses.AppendChild(nodeCourse)
set nodeCrs_idx = objxml.CreateElement("crs_idx") '
set nodeCrs_nm = objxml.CreateElement("crs_nm") '
set nodeEdu_sv_nm = objxml.CreateElement("edu_sv_nm")
set nodeRegdate = objxml.CreateElement("regdate")
nodeCourse.AppendChild(nodeCrs_idx)
nodeCourse.AppendChild(nodeCrs_nm)
nodeCourse.AppendChild(nodeEdu_sv_nm)
nodeCourse.AppendChild(nodeRegdate)
' CDATA 타입 정의
nodeCrs_nm.AppendChild(objxml.createCDATASection("crs_nm_cdata"))
nodeCourse.childnodes(0).text = db_crs_idx
nodeCrs_nm.childnodes(0).text = db_crs_nm
nodeCourse.childnodes(2).text = db_edu_sv_nm
nodeCourse.childnodes(3).text = db_regdate
rs.movenext
loop
Response.ContentType = "text/xml"
Response.Write objxml.xml
Set objxml = nothing
%> |