Loading XML Object from a string

Discussion in 'C#' started by amer.m, Aug 28, 2010.

  1. amer.m

    amer.m New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    HI all,
    I tried to load xml object from record from database , and when i load it from a string directly , it's loaded successfully
    But when connecting to database and take the record that is saved as a string in the form of xml like :
    the connection to database is done successfullt but the xml object never loaded successfully
    My code is :
    Dim DB, temp, RS
    Dim startHour, startMin, endHour, endMin, dayNum
    MsgBox "Done!"



    'Creating XML object
    set xmlDoc=CreateObject("Microsoft.XMLDOM")
    xmlDoc.async="false"

    'XMLString = "The Mayflower TheaterCarnegie Hall"
    'Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
    'objXMLDoc.async = False
    'objXMLDoc.loadXML(XMLString)
    'MsgBox objXMLDoc.text

    'Set Root = objXMLDoc.documentElement
    'MsgBox (Root.xml)


    'Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
    'objXMLDoc.async = False
    For x= 1 to 5
    Set DB = CreateObject ("ADODB.Connection")
    DB.Mode = adModeReadWrite

    'strGraph = "ABB-RAM-OC3-FIB-1"
    DB.Open ("provider of database")

    Set RS = CreateObject ("ADODB.Recordset")
    Query = "SELECT sMaintenanceSchedule FROM Amer where ID='"&x&"'"
    RS.Open Query, DB,1,3
    While Not RS.EOF
    temp=CStr(RS("sMaintenanceSchedule").Value)
    'CStr(temp)
    MsgBox temp

    boolValue=xmlDoc.loadXML(temp)
    MsgBox boolValue
    MsgBox objXMLDoc.text
    'Set Root = objXMLDoc.documentElement
    'MsgBox (Root.xml)

    if x=1 Then
    frmMyForm.timeinfo.value=temp
    End If
    if x=2 Then
    frmMyForm.timeinfo2.value=temp
    End If
    if x=3 Then
    frmMyForm.timeinfo3.value=temp
    End If
    if x=4 Then
    frmMyForm.timeinfo4.value=temp
    End If
    if x=5 Then
    frmMyForm.timeinfo5.value=temp
    End If

    RS.MoveNext
    Wend
    Next


    Anyone help me????
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice