ado and xml?

Discussion in 'ASP General' started by js, Apr 1, 2005.

  1. js

    js Guest

    Hi, I have some questions about replace with mdb file with xml file:
    Can I use ado and xml to store info instead of Ms access database, what
    will be the diff?
    can ado and xml support mult-user
    Concurrent access? Thansk...
     
    js, Apr 1, 2005
    #1
    1. Advertising

  2. js wrote:
    > Hi, I have some questions about replace with mdb file with xml file:


    Don't

    > Can I use ado


    ado is not needed to use xml

    > and xml to store info instead of Ms access database,


    Yes, but ....

    > what will be the diff?


    No referential integrity. No SQL language. No data constraints. xml is
    simply a text file.

    > can ado and xml support mult-user
    > Concurrent access? Thansk...


    No. You will wind up having to reinvent the wheel with your own code. it's
    not worth it.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 1, 2005
    #2
    1. Advertising

  3. js

    js Guest

    Thanks Bob,
    "Bob Barrows [MVP]" wrote in message
    >
    >> can ado and xml support mult-user
    >> Concurrent access? Thansk...

    >
    > No. You will wind up having to reinvent the wheel with your own code. it's
    > not worth it.
    >

    I only have three fields(Email, Password, IP), I think it will simply to use
    text file instead of a database. ado can use discount recordset to bind to a
    extenal file, but I'm worry about the concurrent access problem? what happen
    when more than 10 user access at the same time? Please help...
     
    js, Apr 1, 2005
    #3
  4. js

    js Guest

    Thanks for the help,
    Is it a sample teach how to save info to a file use ado?

    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
    news:...
    > If you are going to have 10+ users accessing this at the same exact moment
    > you will not wany ANY file based storage, this includes MDB. You are going
    > to have to look at an SQL type option.
    >
     
    js, Apr 1, 2005
    #4
  5. js

    js Guest

    Cool...

    "dlbjr" <> wrote in message
    news:...
    > Use the attached XML file and the following code.
    > Do what ever you want with it.
    >
    > Set rs = CreateObject("ADODB.Recordset")
    > rs.Open "data.xml"
    >
    > 'Do What Ever
    >
    > rs.Save "data.xml",1
    > Set rs = Nothing
    >
    >
    >
    > --
    > dlbjr
    > Pleading sagacious indoctrination!
    >
    >
     
    js, Apr 2, 2005
    #5
  6. js

    js Guest

    is it this method only limit to 10+ users accessing this at the same exact
    time? or not limit?


    "dlbjr" <> wrote in message
    news:...
    > Use the attached XML file and the following code.
    > Do what ever you want with it.
    >
    > Set rs = CreateObject("ADODB.Recordset")
    > rs.Open "data.xml"
    >
    > 'Do What Ever
    >
    > rs.Save "data.xml",1
    > Set rs = Nothing
    >
    >
    >
    > --
    > dlbjr
    > Pleading sagacious indoctrination!
    >
    >
     
    js, Apr 2, 2005
    #6
  7. js

    dlbjr Guest

    Limit is not a problem.

    For safety reasons just wrap any code reading, writing the data in
    Application.Lock and Application.Unlock This will guarantee one operation at
    a time.

    --
    dlbjr
    Pleading sagacious indoctrination!
     
    dlbjr, Apr 2, 2005
    #7
  8. dlbjr wrote:
    > Limit is not a problem.
    >
    > For safety reasons just wrap any code reading, writing the data in
    > Application.Lock and Application.Unlock This will guarantee one
    > operation at a time.


    You forgot that he had to spcify keeping the xml file in Application,
    something that is not recommended for ado objects ....

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 2, 2005
    #8
  9. js

    js Guest

    "Bob Barrows [MVP]" wrote in message news:u8f%
    >> Limit is not a problem.
    >>
    >> For safety reasons just wrap any code reading, writing the data in
    >> Application.Lock and Application.Unlock This will guarantee one
    >> operation at a time.

    >
    > You forgot that he had to spcify keeping the xml file in Application,
    > something that is not recommended for ado objects ....
    >

    Can you explain why the xml file is not recommended for ado objects? Thanks.
     
    js, Apr 2, 2005
    #9
  10. js

    js Guest

    "dlbjr" wrote in message
    > Limit is not a problem.
    >
    > For safety reasons just wrap any code reading, writing the data in
    > Application.Lock and Application.Unlock This will guarantee one operation
    > at a time.
    >

    What happen when someone is access the file and lock, and another is trying
    to access it? Will line up? Thanks for the help...
     
    js, Apr 2, 2005
    #10
  11. js wrote:
    > "Bob Barrows [MVP]" wrote in message news:u8f%
    >>> Limit is not a problem.
    >>>
    >>> For safety reasons just wrap any code reading, writing the data in
    >>> Application.Lock and Application.Unlock This will guarantee one
    >>> operation at a time.

    >>
    >> You forgot that he had to spcify keeping the xml file in Application,
    >> something that is not recommended for ado objects ....
    >>

    > Can you explain why the xml file is not recommended for ado objects?
    > Thanks.


    Not the xml object. As long as you use the slow free-threaded version of the
    xml document, you'll be all right. it';s the ADO object I'm talking about.
    ADO by default is not free-threaded, and therefore should not be kept int
    session or application.

    http://www.aspfaq.com/show.asp?id=2053

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 2, 2005
    #11
  12. js wrote:
    > "dlbjr" wrote in message
    >> Limit is not a problem.
    >>
    >> For safety reasons just wrap any code reading, writing the data in
    >> Application.Lock and Application.Unlock This will guarantee one
    >> operation at a time.
    >>

    > What happen when someone is access the file and lock, and another is
    > trying to access it? Will line up? Thanks for the help...


    You will force all accesses of the object to be serialized, which will limit
    scalability, You really should forget this idea, especially if your data is
    related to other data. A database is designed for this.

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 2, 2005
    #12
  13. js

    js Guest

    Thanks Bob.
     
    js, Apr 2, 2005
    #13
  14. js

    dlbjr Guest

    The solution will work for your need.
    For the picky ones, you could use a true dataset offered in asp.net.
    Make calls to an aspx file to add,edit or delete data then serialize the dataset.
    Everything else stays asp.

    'dlbjr
    'Pleading sagacious indoctrination!
     
    dlbjr, Apr 2, 2005
    #14
  15. js

    Roland Hall Guest

    "Bob Barrows [MVP]" wrote in message
    news:...
    : js wrote:
    : > Hi, I have some questions about replace with mdb file with xml file:
    :
    : Don't
    :
    : > Can I use ado
    :
    : ado is not needed to use xml
    :
    : > and xml to store info instead of Ms access database,
    :
    : Yes, but ....
    :
    : > what will be the diff?
    :
    : No referential integrity. No SQL language. No data constraints. xml is
    : simply a text file.
    :
    : > can ado and xml support mult-user
    : > Concurrent access? Thansk...
    :
    : No. You will wind up having to reinvent the wheel with your own code. it's
    : not worth it.

    Not sure what you're saying here Bob. Are you saying using an XML file on
    the net with multiple users is a bad idea?

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Apr 2, 2005
    #15
  16. Roland Hall wrote:
    > "Bob Barrows [MVP]" wrote in message
    > news:...
    >> js wrote:
    >>> Hi, I have some questions about replace with mdb file with xml file:

    >>
    >> Don't
    >>
    >>> Can I use ado

    >>
    >> ado is not needed to use xml
    >>
    >>> and xml to store info instead of Ms access database,

    >>
    >> Yes, but ....
    >>
    >>> what will be the diff?

    >>
    >> No referential integrity. No SQL language. No data constraints. xml
    >> is simply a text file.
    >>
    >>> can ado and xml support mult-user
    >>> Concurrent access? Thansk...

    >>
    >> No. You will wind up having to reinvent the wheel with your own
    >> code. it's not worth it.

    >
    > Not sure what you're saying here Bob. Are you saying using an XML
    > file on the net with multiple users is a bad idea?


    I'm not sure if this is a facetious question or not, but I'll answer it as
    if it is a straight question, given that I may have over-made my point. :)

    So, "Are you saying using an XML file on the net with multiple users is a
    bad idea?"

    A. Not necessarily.

    I'm saying that replacing a database, which provides the builtin
    functionality to support multiple users and protect the integrity of the
    data it contains, with a text file, xml or csv, may not be a good idea. It
    forces the developer to reinvent the wheel, writing all the code to provide
    the same functionality that was provided by the database. Consider the years
    it has taken the developers of Jet to get to the point they are at now, as
    well as all the mistakes that were made and corrected along the way.
    Providing that functionality is not an easy task. Not impossible, but
    definitely daunting.

    However:
    Using a read-only (or update-rarely) text file (or xml document stored in
    application or session) to cache frequently used, relatively static data is
    a very good idea. In a perfect world, the data would still come from a
    database, but with truly static data, that is not necessary.

    Bob Barrows
    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 2, 2005
    #16
  17. js

    js Guest

    Hello, can I use csv file instead of data.xml file?

    "dlbjr" <> wrote in message
    news:...
    > Use the attached XML file and the following code.
    > Do what ever you want with it.
    >
    > Set rs = CreateObject("ADODB.Recordset")
    > rs.Open "data.xml"
    >
    > 'Do What Ever
    >
    > rs.Save "data.xml",1
    > Set rs = Nothing
    >
    >
     
    js, Apr 2, 2005
    #17
  18. js

    Roland Hall Guest

    "Bob Barrows [MVP]" wrote in message
    news:...
    : Roland Hall wrote:
    : > "Bob Barrows [MVP]" wrote in message
    : > news:...
    : >> js wrote:
    : >>> Hi, I have some questions about replace with mdb file with xml file:
    : >>
    : >> Don't
    : >>
    : >>> Can I use ado
    : >>
    : >> ado is not needed to use xml
    : >>
    : >>> and xml to store info instead of Ms access database,
    : >>
    : >> Yes, but ....
    : >>
    : >>> what will be the diff?
    : >>
    : >> No referential integrity. No SQL language. No data constraints. xml
    : >> is simply a text file.
    : >>
    : >>> can ado and xml support mult-user
    : >>> Concurrent access? Thansk...
    : >>
    : >> No. You will wind up having to reinvent the wheel with your own
    : >> code. it's not worth it.
    : >
    : > Not sure what you're saying here Bob. Are you saying using an XML
    : > file on the net with multiple users is a bad idea?
    :
    : I'm not sure if this is a facetious question or not, but I'll answer it as
    : if it is a straight question, given that I may have over-made my point.
    :)

    I know I kid around a lot but it was a straight question.

    : So, "Are you saying using an XML file on the net with multiple users is a
    : bad idea?"
    :
    : A. Not necessarily.
    :
    : I'm saying that replacing a database, which provides the builtin
    : functionality to support multiple users and protect the integrity of the
    : data it contains, with a text file, xml or csv, may not be a good idea. It
    : forces the developer to reinvent the wheel, writing all the code to
    provide
    : the same functionality that was provided by the database. Consider the
    years
    : it has taken the developers of Jet to get to the point they are at now, as
    : well as all the mistakes that were made and corrected along the way.
    : Providing that functionality is not an easy task. Not impossible, but
    : definitely daunting.
    :
    : However:
    : Using a read-only (or update-rarely) text file (or xml document stored in
    : application or session) to cache frequently used, relatively static data
    is
    : a very good idea. In a perfect world, the data would still come from a
    : database, but with truly static data, that is not necessary.

    So, if a read-only XML file is shared and RW XML files are separate for each
    user, that's not an issue? I'm asking because I'm doing that in lieu of
    using an Access database and getting good results. I will however be
    offering multiple database versions but for now, just XML.

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
     
    Roland Hall, Apr 2, 2005
    #18
  19. js

    dlbjr Guest

    js,

    Once the data is loaded into the recordset you can filter, sort, add, edit, delete the data just as
    in SQL.
    Where are you storing data in a session or application Variable?
    If needed the xml can be Serialized into a string for storing in an application variable.

    Take a look at the following code. This is used to store XML in a session or application Variable
    and load and unload into a recordset when needed. This can be on an include asp file if needed.

    I would store the xml file on the harddrive myself.

    <SCRIPT language="vbscript" runat="server">
    Class RSXML
    Private mrecordset
    Private mxmldom

    Private Sub Class_Initialize()
    Set mxmldom = CreateObject("MSXML2.DOMDocument")
    Set mrecordset = CreateObject("ADODB.Recordset")
    End Sub

    Private Sub Class_Terminate()
    Set mxmldom = Nothing
    Set mrecordset = Nothing
    End Sub

    Public Function Serialize(recordset)
    On Error Resume Next
    recordset.Save mxmldom, 1
    Serialize = mxmldom.xml
    End Function

    Public Function Deserialize(strXML)
    On Error Resume Next
    mxmldom.loadXML strXML
    mrecordset.Open mxmldom
    Set Deserialize = mrecordset
    End Function
    End Class
    </SCRIPT>


    'dlbjr
    'Pleading sagacious indoctrination!
     
    dlbjr, Apr 2, 2005
    #19
  20. Roland Hall wrote:
    >
    > So, if a read-only XML file is shared and RW XML files are separate
    > for each user, that's not an issue?


    Correct. I see nothing wrong with that. In fact, I use similar strategy in a
    few of my apps.

    Bob

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
     
    Bob Barrows [MVP], Apr 2, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Robert Rossney
    Replies:
    0
    Views:
    566
    Robert Rossney
    Feb 7, 2006
  2. nita
    Replies:
    1
    Views:
    898
    Saravana
    Nov 20, 2004
  3. ronaldlee

    Transfer ADO Code to ADO.NET

    ronaldlee, Dec 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    487
    Kevin Spencer
    Dec 17, 2004
  4. Replies:
    0
    Views:
    1,337
  5. Navin
    Replies:
    1
    Views:
    748
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page