View Single Post
  #2 (permalink)  
Old July 30th, 2003, 03:23 AM
tknguyen tknguyen is offline
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dim xmlData, nodPerson, sSQL, sID, sName, sPhone, sSection, sDesign
Set xmlData = Server.CreateObject("Msxml2.DOMDocument.4.0")
Set nodPerson = xmlData.documentElement.selectSingleNode("person[@id='1']")

sID = nodPerson.getAttribute("id")
sName = nodPerson.selectSingleNode("name").text
sPhone = nodPerson.selectSingleNode("phone").text
sSection = nodPerson.selectSingleNode("section").text
sDesign = nodPerson.selectSingleNode("designation").text

'assume all fields are alphanumeric (varchar, char,...) and id is integer
sSQL = "UPDATE your_table SET name='" & sName & "', phone='" & sPhone & "', section='" & sSection & "', designation='" & sDesign & "' WHERE id=" & sID

'assume you have an opened connection (you didn't tell what type of DB you use)
cn.Execute(sSQL)

'you can also send the whole xml document to SQL Server 2000 as a ntext field, i can send you example if you want to know

Hope this help
Khoa Nguyen