Display xml file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Display xml file

  1. #1
    rana Guest

    Display xml file


    Hi

    I would like to display an xml file to another database in Vb environment.
    I have no idea how to proceed it.
    I need some help!

    rana

  2. #2
    DevX Discussions Guest

    Re: Display xml file

    You need to provide some more information. Do you mean you want to save the
    contents of an XML file in some database? A sample of your XML will help
    someone answer you clearly.

    "rana" <rahmam@yahoo.com> wrote in message news:3a2d21b1$1@news.devx.com...
    >
    > Hi
    >
    > I would like to display an xml file to another database in Vb environment.
    > I have no idea how to proceed it.
    > I need some help!
    >
    > rana




  3. #3
    rana Guest

    Re: Display xml file


    Hi!

    i have created an xml file from Access database using ADO recordset 2.1 in
    VB environment.I would like to send that file to another Access database.XML
    will be act as a bridge between two databases. I'm using following codes:


    Private Sub CreateXML_Click()
    '
    Dim strSQLstring As String

    Dim rsXML As ADODB.Recordset
    Dim strFile_Name As String
    '
    txtSQLstring = "SELECT * FROM Applications"
    strSQLstring = txtSQLstring
    '
    'Save a recordset to disk
    '
    'open table, use optimistic locking with a static cursor
    Set rsXML = New ADODB.Recordset
    DataEnvironment1.cnn_Access.Open
    Set rsXML.ActiveConnection = DataEnvironment1.cnn_Access
    'DataEnvironment1 is the name that you provided in the previous steps

    rsXML.Source = strSQLstring
    rsXML.CursorType = adOpenStatic
    rsXML.LockType = adLockOptimistic
    rsXML.CursorLocation = adUseClient
    rsXML.Open
    '
    'save to file
    '
    'open a common dialog box to obtain the file
    ' name from user
    '
    With CommonDialog1
    .DefaultExt = ".xml"
    .DialogTitle = "Export Data from Access to XML File"
    .Filter = "XML Files | *.xml"
    .ShowSave
    strFile_Name = .FileName
    End With
    '
    'Clear the string
    On Error Resume Next
    Kill strFile_Name
    '
    '
    'save the recordset
    rsXML.Save strFile_Name, adPersistXML
    'remove it from memory
    rsXML.Close
    Set rsXML = Nothing
    '
    MsgBox "Report has been saved to " & strFile_Name, _
    vbInformation, "Reporting - Save XML File"

    DataEnvironment1.cnn_Access.Close
    Report_Exit:

    End Sub


    Private Sub ReadXMLFile_Click()
    'load a previously-saved recordset
    Dim rst As New ADODB.Recordset
    Dim rst_Server As New ADODB.Recordset
    Dim cnn_FMPro As New ADODB.Connection
    Dim strFile As String

    'construct a file name

    With CommonDialog1
    .DefaultExt = ".xml"
    .DialogTitle = "Import Access XML File into File Maker Pro"
    .Filter = "XML Files | *.xml"
    .ShowOpen
    strFile = .FileName
    End With

    'open the recordset from the file
    rst.Open strFile, , adOpenStatic, _
    adLockPessimistic

    'show that we're got data
    MsgBox rst.RecordCount & " Records Found."

    Msgbox gives no of records, afterwards I don't know how to transfer records
    to another database.

    Rana



    "DevX Discussions" <arj1@northstate.net> wrote:
    >You need to provide some more information. Do you mean you want to save

    the
    >contents of an XML file in some database? A sample of your XML will help
    >someone answer you clearly.
    >
    >"rana" <rahmam@yahoo.com> wrote in message news:3a2d21b1$1@news.devx.com...
    >>
    >> Hi
    >>
    >> I would like to display an xml file to another database in Vb environment.
    >> I have no idea how to proceed it.
    >> I need some help!
    >>
    >> rana

    >
    >



  4. #4
    Russell Jones Guest

    Re: Display xml file

    1. Open an empty recordset (targetRS) on the table where you want to insert
    the data.
    2. Loop through the recordset you load from the file (srcRS). For each field
    in each row, assign the field value to the corresponding field in targetRS
    3. At the end of each row, update targetRS

    Alternately, you can perform the update via an SQL statement.

    Note that XML is an inefficient format for moving data from one Access
    database to another, and that Access contains numerous ways to perform this
    operation faster and with fewer possibilities for error.

    "rana" <rahmam@yahoo.com> wrote in message news:3a2eb927$1@news.devx.com...
    >
    > Hi!
    >
    > i have created an xml file from Access database using ADO recordset 2.1 in
    > VB environment.I would like to send that file to another Access

    database.XML
    > will be act as a bridge between two databases. I'm using following codes:
    >
    >
    > Private Sub CreateXML_Click()
    > '
    > Dim strSQLstring As String
    >
    > Dim rsXML As ADODB.Recordset
    > Dim strFile_Name As String
    > '
    > txtSQLstring = "SELECT * FROM Applications"
    > strSQLstring = txtSQLstring
    > '
    > 'Save a recordset to disk
    > '
    > 'open table, use optimistic locking with a static cursor
    > Set rsXML = New ADODB.Recordset
    > DataEnvironment1.cnn_Access.Open
    > Set rsXML.ActiveConnection = DataEnvironment1.cnn_Access
    > 'DataEnvironment1 is the name that you provided in the previous steps
    >
    > rsXML.Source = strSQLstring
    > rsXML.CursorType = adOpenStatic
    > rsXML.LockType = adLockOptimistic
    > rsXML.CursorLocation = adUseClient
    > rsXML.Open
    > '
    > 'save to file
    > '
    > 'open a common dialog box to obtain the file
    > ' name from user
    > '
    > With CommonDialog1
    > .DefaultExt = ".xml"
    > .DialogTitle = "Export Data from Access to XML File"
    > .Filter = "XML Files | *.xml"
    > .ShowSave
    > strFile_Name = .FileName
    > End With
    > '
    > 'Clear the string
    > On Error Resume Next
    > Kill strFile_Name
    > '
    > '
    > 'save the recordset
    > rsXML.Save strFile_Name, adPersistXML
    > 'remove it from memory
    > rsXML.Close
    > Set rsXML = Nothing
    > '
    > MsgBox "Report has been saved to " & strFile_Name, _
    > vbInformation, "Reporting - Save XML File"
    >
    > DataEnvironment1.cnn_Access.Close
    > Report_Exit:
    >
    > End Sub
    >
    >
    > Private Sub ReadXMLFile_Click()
    > 'load a previously-saved recordset
    > Dim rst As New ADODB.Recordset
    > Dim rst_Server As New ADODB.Recordset
    > Dim cnn_FMPro As New ADODB.Connection
    > Dim strFile As String
    >
    > 'construct a file name
    >
    > With CommonDialog1
    > .DefaultExt = ".xml"
    > .DialogTitle = "Import Access XML File into File Maker Pro"
    > .Filter = "XML Files | *.xml"
    > .ShowOpen
    > strFile = .FileName
    > End With
    >
    > 'open the recordset from the file
    > rst.Open strFile, , adOpenStatic, _
    > adLockPessimistic
    >
    > 'show that we're got data
    > MsgBox rst.RecordCount & " Records Found."
    >
    > Msgbox gives no of records, afterwards I don't know how to transfer

    records
    > to another database.
    >
    > Rana
    >
    >
    >
    > "DevX Discussions" <arj1@northstate.net> wrote:
    > >You need to provide some more information. Do you mean you want to save

    > the
    > >contents of an XML file in some database? A sample of your XML will help
    > >someone answer you clearly.
    > >
    > >"rana" <rahmam@yahoo.com> wrote in message

    news:3a2d21b1$1@news.devx.com...
    > >>
    > >> Hi
    > >>
    > >> I would like to display an xml file to another database in Vb

    environment.
    > >> I have no idea how to proceed it.
    > >> I need some help!
    > >>
    > >> rana

    > >
    > >

    >




  5. #5
    rana Guest

    Re: Display xml file


    Hi!
    My intension is to send those recordsets to the web.
    Instead of using Access database in the later case, if I use differnt database
    such as FileMaker Pro, then how am I gonna proceed? (i.e. Access database
    <-> XML <->FileMaker Pro then web)But the problem of FileMaker Pro is that
    it has different extension i.e. .fp5. If I load xml to FileMaker Pro , I
    have to change its extension to .fp5.

    I really need some helps in this regards!

    rana



    "Russell Jones" <arj1@northstate.net> wrote:
    >1. Open an empty recordset (targetRS) on the table where you want to insert
    >the data.
    >2. Loop through the recordset you load from the file (srcRS). For each field
    >in each row, assign the field value to the corresponding field in targetRS
    >3. At the end of each row, update targetRS
    >
    >Alternately, you can perform the update via an SQL statement.
    >
    >Note that XML is an inefficient format for moving data from one Access
    >database to another, and that Access contains numerous ways to perform this
    >operation faster and with fewer possibilities for error.
    >
    >"rana" <rahmam@yahoo.com> wrote in message news:3a2eb927$1@news.devx.com...
    >>
    >> Hi!
    >>
    >> i have created an xml file from Access database using ADO recordset 2.1

    in
    >> VB environment.I would like to send that file to another Access

    >database.XML
    >> will be act as a bridge between two databases. I'm using following codes:
    >>
    >>
    >> Private Sub CreateXML_Click()
    >> '
    >> Dim strSQLstring As String
    >>
    >> Dim rsXML As ADODB.Recordset
    >> Dim strFile_Name As String
    >> '
    >> txtSQLstring = "SELECT * FROM Applications"
    >> strSQLstring = txtSQLstring
    >> '
    >> 'Save a recordset to disk
    >> '
    >> 'open table, use optimistic locking with a static cursor
    >> Set rsXML = New ADODB.Recordset
    >> DataEnvironment1.cnn_Access.Open
    >> Set rsXML.ActiveConnection = DataEnvironment1.cnn_Access
    >> 'DataEnvironment1 is the name that you provided in the previous steps
    >>
    >> rsXML.Source = strSQLstring
    >> rsXML.CursorType = adOpenStatic
    >> rsXML.LockType = adLockOptimistic
    >> rsXML.CursorLocation = adUseClient
    >> rsXML.Open
    >> '
    >> 'save to file
    >> '
    >> 'open a common dialog box to obtain the file
    >> ' name from user
    >> '
    >> With CommonDialog1
    >> .DefaultExt = ".xml"
    >> .DialogTitle = "Export Data from Access to XML File"
    >> .Filter = "XML Files | *.xml"
    >> .ShowSave
    >> strFile_Name = .FileName
    >> End With
    >> '
    >> 'Clear the string
    >> On Error Resume Next
    >> Kill strFile_Name
    >> '
    >> '
    >> 'save the recordset
    >> rsXML.Save strFile_Name, adPersistXML
    >> 'remove it from memory
    >> rsXML.Close
    >> Set rsXML = Nothing
    >> '
    >> MsgBox "Report has been saved to " & strFile_Name, _
    >> vbInformation, "Reporting - Save XML File"
    >>
    >> DataEnvironment1.cnn_Access.Close
    >> Report_Exit:
    >>
    >> End Sub
    >>
    >>
    >> Private Sub ReadXMLFile_Click()
    >> 'load a previously-saved recordset
    >> Dim rst As New ADODB.Recordset
    >> Dim rst_Server As New ADODB.Recordset
    >> Dim cnn_FMPro As New ADODB.Connection
    >> Dim strFile As String
    >>
    >> 'construct a file name
    >>
    >> With CommonDialog1
    >> .DefaultExt = ".xml"
    >> .DialogTitle = "Import Access XML File into File Maker Pro"
    >> .Filter = "XML Files | *.xml"
    >> .ShowOpen
    >> strFile = .FileName
    >> End With
    >>
    >> 'open the recordset from the file
    >> rst.Open strFile, , adOpenStatic, _
    >> adLockPessimistic
    >>
    >> 'show that we're got data
    >> MsgBox rst.RecordCount & " Records Found."
    >>
    >> Msgbox gives no of records, afterwards I don't know how to transfer

    >records
    >> to another database.
    >>
    >> Rana
    >>
    >>
    >>
    >> "DevX Discussions" <arj1@northstate.net> wrote:
    >> >You need to provide some more information. Do you mean you want to save

    >> the
    >> >contents of an XML file in some database? A sample of your XML will help
    >> >someone answer you clearly.
    >> >
    >> >"rana" <rahmam@yahoo.com> wrote in message

    >news:3a2d21b1$1@news.devx.com...
    >> >>
    >> >> Hi
    >> >>
    >> >> I would like to display an xml file to another database in Vb

    >environment.
    >> >> I have no idea how to proceed it.
    >> >> I need some help!
    >> >>
    >> >> rana
    >> >
    >> >

    >>

    >
    >



  6. #6
    Russell Jones Guest

    Re: Display xml file

    In that case, you'll need to loop through the returned data and create your
    own XML string.

    "rana" <rahmam@yahoo.com> wrote in message news:3a2fb980$1@news.devx.com...
    >
    > Hi!
    > My intension is to send those recordsets to the web.
    > Instead of using Access database in the later case, if I use differnt

    database
    > such as FileMaker Pro, then how am I gonna proceed? (i.e. Access database
    > <-> XML <->FileMaker Pro then web)But the problem of FileMaker Pro is

    that
    > it has different extension i.e. .fp5. If I load xml to FileMaker Pro , I
    > have to change its extension to .fp5.
    >
    > I really need some helps in this regards!
    >
    > rana
    >
    >
    >
    > "Russell Jones" <arj1@northstate.net> wrote:
    > >1. Open an empty recordset (targetRS) on the table where you want to

    insert
    > >the data.
    > >2. Loop through the recordset you load from the file (srcRS). For each

    field
    > >in each row, assign the field value to the corresponding field in

    targetRS
    > >3. At the end of each row, update targetRS
    > >
    > >Alternately, you can perform the update via an SQL statement.
    > >
    > >Note that XML is an inefficient format for moving data from one Access
    > >database to another, and that Access contains numerous ways to perform

    this
    > >operation faster and with fewer possibilities for error.
    > >
    > >"rana" <rahmam@yahoo.com> wrote in message

    news:3a2eb927$1@news.devx.com...
    > >>
    > >> Hi!
    > >>
    > >> i have created an xml file from Access database using ADO recordset 2.1

    > in
    > >> VB environment.I would like to send that file to another Access

    > >database.XML
    > >> will be act as a bridge between two databases. I'm using following

    codes:
    > >>
    > >>
    > >> Private Sub CreateXML_Click()
    > >> '
    > >> Dim strSQLstring As String
    > >>
    > >> Dim rsXML As ADODB.Recordset
    > >> Dim strFile_Name As String
    > >> '
    > >> txtSQLstring = "SELECT * FROM Applications"
    > >> strSQLstring = txtSQLstring
    > >> '
    > >> 'Save a recordset to disk
    > >> '
    > >> 'open table, use optimistic locking with a static cursor
    > >> Set rsXML = New ADODB.Recordset
    > >> DataEnvironment1.cnn_Access.Open
    > >> Set rsXML.ActiveConnection = DataEnvironment1.cnn_Access
    > >> 'DataEnvironment1 is the name that you provided in the previous

    steps
    > >>
    > >> rsXML.Source = strSQLstring
    > >> rsXML.CursorType = adOpenStatic
    > >> rsXML.LockType = adLockOptimistic
    > >> rsXML.CursorLocation = adUseClient
    > >> rsXML.Open
    > >> '
    > >> 'save to file
    > >> '
    > >> 'open a common dialog box to obtain the file
    > >> ' name from user
    > >> '
    > >> With CommonDialog1
    > >> .DefaultExt = ".xml"
    > >> .DialogTitle = "Export Data from Access to XML File"
    > >> .Filter = "XML Files | *.xml"
    > >> .ShowSave
    > >> strFile_Name = .FileName
    > >> End With
    > >> '
    > >> 'Clear the string
    > >> On Error Resume Next
    > >> Kill strFile_Name
    > >> '
    > >> '
    > >> 'save the recordset
    > >> rsXML.Save strFile_Name, adPersistXML
    > >> 'remove it from memory
    > >> rsXML.Close
    > >> Set rsXML = Nothing
    > >> '
    > >> MsgBox "Report has been saved to " & strFile_Name, _
    > >> vbInformation, "Reporting - Save XML File"
    > >>
    > >> DataEnvironment1.cnn_Access.Close
    > >> Report_Exit:
    > >>
    > >> End Sub
    > >>
    > >>
    > >> Private Sub ReadXMLFile_Click()
    > >> 'load a previously-saved recordset
    > >> Dim rst As New ADODB.Recordset
    > >> Dim rst_Server As New ADODB.Recordset
    > >> Dim cnn_FMPro As New ADODB.Connection
    > >> Dim strFile As String
    > >>
    > >> 'construct a file name
    > >>
    > >> With CommonDialog1
    > >> .DefaultExt = ".xml"
    > >> .DialogTitle = "Import Access XML File into File Maker Pro"
    > >> .Filter = "XML Files | *.xml"
    > >> .ShowOpen
    > >> strFile = .FileName
    > >> End With
    > >>
    > >> 'open the recordset from the file
    > >> rst.Open strFile, , adOpenStatic, _
    > >> adLockPessimistic
    > >>
    > >> 'show that we're got data
    > >> MsgBox rst.RecordCount & " Records Found."
    > >>
    > >> Msgbox gives no of records, afterwards I don't know how to transfer

    > >records
    > >> to another database.
    > >>
    > >> Rana
    > >>
    > >>
    > >>
    > >> "DevX Discussions" <arj1@northstate.net> wrote:
    > >> >You need to provide some more information. Do you mean you want to

    save
    > >> the
    > >> >contents of an XML file in some database? A sample of your XML will

    help
    > >> >someone answer you clearly.
    > >> >
    > >> >"rana" <rahmam@yahoo.com> wrote in message

    > >news:3a2d21b1$1@news.devx.com...
    > >> >>
    > >> >> Hi
    > >> >>
    > >> >> I would like to display an xml file to another database in Vb

    > >environment.
    > >> >> I have no idea how to proceed it.
    > >> >> I need some help!
    > >> >>
    > >> >> rana
    > >> >
    > >> >
    > >>

    > >
    > >

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center