This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Microsoft XML > March 2004 > VB + XML





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author VB + XML
Shelby461

2004-02-24, 1:31 pm

I am trying to create a VB6 app that will use ADO to save, edit and delete a record. This app will use an XML file for the data storage. Has anyone developped such an app before and can illustrate some code that shows how to accomplish this? Can anyone il
lustrate some code that is used in VB to add, update an XML file. Thanks!
Julius Mong

2004-02-24, 2:29 pm

try www.planetsourcecode.com

"Shelby461" <anonymous@discussions.microsoft.com> wrote in message
news:7BFA6444-38D3-4C85-99B9-E0D6A9B83466@microsoft.com...
> I am trying to create a VB6 app that will use ADO to save, edit and delete

a record. This app will use an XML file for the data storage. Has anyone
developped such an app before and can illustrate some code that shows how to
accomplish this? Can anyone illustrate some code that is used in VB to add,
update an XML file. Thanks!


Chris Barber

2004-02-24, 2:29 pm

Can you be a bit more specific here - ADO and XML are not really
complimentary unless you are talking about the capability to persist a
recordset to disk as XML and reconstruct it again form disk.
In terms of XML documents then you should use the XML DOM
(MSXML2.DOMDocument.4.0 for example) and look at the load, loadXML and save
methods.
For locating elements in the XML then make sure you understand about XPath
(and XSLPattern if using MSXML v3.0 or previous).

If you have any specific tasks regarding XML then please post the questions
and we'll do our best to answer them. A full response to your existing
question here would probably run to the size of a book in terms of examples
and complexity.

Chris.

"Shelby461" <anonymous@discussions.microsoft.com> wrote in message
news:7BFA6444-38D3-4C85-99B9-E0D6A9B83466@microsoft.com...
I am trying to create a VB6 app that will use ADO to save, edit and delete a
record. This app will use an XML file for the data storage. Has anyone
developped such an app before and can illustrate some code that shows how to
accomplish this? Can anyone illustrate some code that is used in VB to add,
update an XML file. Thanks!


Shelby461

2004-02-24, 7:30 pm

I am referring to the capability to persist a recordset to disk as XML and reconstruct it again form disk. I opened with:
rs.Open App.Path & "\AdoRsXml.xml", "Provider=MSPersist"

Call BindTextBoxes

Public Sub BindTextBoxes()

'Bind the text fields to the columns
Set txtCompanyName.DataSource = rs
Set txtContactName.DataSource = rs
Set txtAddress.DataSource = rs
Set txtCity.DataSource = rs

txtCompanyName.DataField = "CompanyName"
txtContactName.DataField = "ContactName"
txtAddress.DataField = "Address"
txtCity.DataField = "City"

End Sub

How do you update, Save or Delete
Chris Barber

2004-02-24, 10:29 pm

Update, save or delete what?

If its a recordset then you use ADO to call the database and execute SQL
commands (or use disconnected recordsets and make the changes locally
marshalling changes back to the server with .BatchUpdate).
The XML is only a local persisted form of the recordset and shouldn't be
manipulated directly. In order to make the recordset 'active' again you have
to reconnect it back to the existing database using an identical connection
string to that used to retrieve the recordset.

http://www.mcpressonline.com/mc/1@1...nvA.0@.214a2bfd

I'd personally use disconnected recordsets for lot of reasons. Most of all,
you can add, remove and edit records directly in the recordset and just push
the updates back whenever you want.

http://www.4guysfromrolla.com/webtech/080101-1.shtml [and more on Google].

Chris.

"Shelby461" <anonymous@discussions.microsoft.com> wrote in message
news:57D09F37-2386-4F94-BC32-E5209BC4D23A@microsoft.com...
I am referring to the capability to persist a recordset to disk as XML and
reconstruct it again form disk. I opened with:
rs.Open App.Path & "\AdoRsXml.xml", "Provider=MSPersist"

Call BindTextBoxes

Public Sub BindTextBoxes()

'Bind the text fields to the columns
Set txtCompanyName.DataSource = rs
Set txtContactName.DataSource = rs
Set txtAddress.DataSource = rs
Set txtCity.DataSource = rs

txtCompanyName.DataField = "CompanyName"
txtContactName.DataField = "ContactName"
txtAddress.DataField = "Address"
txtCity.DataField = "City"

End Sub

How do you update, Save or Delete


Han

2004-02-25, 5:29 am

In short, bind the XML recordset to some controls, save the xml/recordset in
memory to the physical disk when Form or something unloads. One of earlier
replies.

http://www.google.com/groups?hl=en&...lr%3D%26hl%3Den

--
Pohwan Han, Microsoft MVP, ASP/ASP.Net, Korea
Have a nice day.

"Shelby461" <anonymous@discussions.microsoft.com> wrote in message
news:57D09F37-2386-4F94-BC32-E5209BC4D23A@microsoft.com...
> I am referring to the capability to persist a recordset to disk as XML and

reconstruct it again form disk. I opened with:
> rs.Open App.Path & "\AdoRsXml.xml", "Provider=MSPersist"
>
> Call BindTextBoxes
>
> Public Sub BindTextBoxes()
>
> 'Bind the text fields to the columns
> Set txtCompanyName.DataSource = rs
> Set txtContactName.DataSource = rs
> Set txtAddress.DataSource = rs
> Set txtCity.DataSource = rs
>
> txtCompanyName.DataField = "CompanyName"
> txtContactName.DataField = "ContactName"
> txtAddress.DataField = "Address"
> txtCity.DataField = "City"
>
> End Sub
>
> How do you update, Save or Delete



Shelby461

2004-03-05, 11:29 pm

Thanks Chris,

I think using the disconnected recordset is the route I need to take.

"Han" <hp4444@kornet.net.korea> wrote in message
news:e7ll8p3%23DHA.2012@TK2MSFTNGP11.phx.gbl...
> In short, bind the XML recordset to some controls, save the xml/recordset

in
> memory to the physical disk when Form or something unloads. One of earlier
> replies.
>
>

http://www.google.com/groups?hl=en&...lr%3D%26hl%3Den
>
> --
> Pohwan Han, Microsoft MVP, ASP/ASP.Net, Korea
> Have a nice day.
>
> "Shelby461" <anonymous@discussions.microsoft.com> wrote in message
> news:57D09F37-2386-4F94-BC32-E5209BC4D23A@microsoft.com...
and[color=darkred]
> reconstruct it again form disk. I opened with:
>
>



Chris Barber

2004-03-05, 11:29 pm

If it's Access or SQL Server then take a look at the VB class wrapper in:

http://ftp.belper.blue-canoe.net/rsaccess/rsaccess.zip

that provides common methods of retrieving and updating disconnected
recordsets.

The basic premise is:

1. Get recordset (see cursor location for 'disconnected') - GetSQLRS
function for example.
2. Make changes to the recordset as required - add, edit, delete.
3. Pass the recordset back tot he DB for the changes to be made (called
'marshalling') - UpdateSQLRS function.

Chris.

"Shelby461" <brenjoe3@msn.com> wrote in message
news:eFe$AZyAEHA.4080@TK2MSFTNGP09.phx.gbl...
Thanks Chris,

I think using the disconnected recordset is the route I need to take.

"Han" <hp4444@kornet.net.korea> wrote in message
news:e7ll8p3%23DHA.2012@TK2MSFTNGP11.phx.gbl...
> In short, bind the XML recordset to some controls, save the xml/recordset

in
> memory to the physical disk when Form or something unloads. One of earlier
> replies.
>
>

http://www.google.com/groups?hl=en&...lr%3D%26hl%3Den
>
> --
> Pohwan Han, Microsoft MVP, ASP/ASP.Net, Korea
> Have a nice day.
>
> "Shelby461" <anonymous@discussions.microsoft.com> wrote in message
> news:57D09F37-2386-4F94-BC32-E5209BC4D23A@microsoft.com...
and[color=darkred]
> reconstruct it again form disk. I opened with:
>
>




joan desousa

2004-03-30, 10:15 pm



joan_de_sousa1@hotmail.com


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews