Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / April 2008



Tip: Looking for answers? Try searching our database.

Copying data between servers with persisted XML

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Leach - 15 Apr 2008 20:26 GMT
My company has a VB6 application that accesses SQL Server 2005. Our
consultants demo this application from laptops that have SQL Express
installed. Periodically we need to repopulate the "demo" databases with data
from our development server. This should be done by the consultants who will
NOT have intimate knowledge of SQL Server therefore I built a small VB
application to:

1. Persist data from the development server to XML files
2. Open an ADO recordset with the XML files as the source, connect to the
"target" server (on the laptop) and update the recordset.

(Assume I have already cleared the target tables and reset IDENTITY counters)

Everything works except my .UpdateBatch() call when connected to the
"target" server - I do NOT get an error, the data simply doesn't appear.

Below is a sample of the code I use to import the XML file.

Dim adoRS As New ADODB.Recordset

With adoRS
 .Open "C:\Data\Address.xml", , adOpenStatic, adLockBatchOptimistic,
adCmdFile
 .ActiveConnection = strConn '< this is a valid connection string to my
target database, I have also tried an open ADODB.Connection object
 .UpdateBatch '< update appears to fail but no error generated
 Set .ActiveConnection = Nothing
 .Close
End With

I do not understand why the table is not populated.
I did notice that the XML file has a reference to the DB name on the old
server, the DB name on the target server will be different.

Any help greatly appreciated.

Regards,

Jim Leach
Jan Hyde (VB MVP) - 16 Apr 2008 09:08 GMT
Jim Leach <JimLeach@discussions.microsoft.com>'s wild
thoughts were released on Tue, 15 Apr 2008 12:26:02 -0700
bearing the following fruit:

>My company has a VB6 application that accesses SQL Server 2005. Our
>consultants demo this application from laptops that have SQL Express
[quoted text clipped - 35 lines]
>
>Jim Leach

If you don't mind the suggestion of a third party tool,
Red-Gate had a tool that alows you to quickly create a setup
program that your consultants can run and it will
automatically add all your new data, as well as implement
any table changes etc

http://www.red-gate.com/products/SQL_Packager/index.htm

--
Jan Hyde

https://mvp.support.microsoft.com/profile/Jan.Hyde
roger - 20 Apr 2008 03:10 GMT
> My company has a VB6 application that accesses SQL Server 2005. Our
> consultants demo this application from laptops that have SQL Express
[quoted text clipped - 11 lines]
> Everything works except my .UpdateBatch() call when connected to the
> "target" server - I do NOT get an error, the data simply doesn't appear.

Does your XML look like this?

<rs:data>
 <z:row etc... />
 <z:row etc... />
</rs:data>

Try making it look like this...

<rs:data>
 <rs:insert>
 <z:row etc... />
 <z:row etc... />
 </rs:insert>
</rs:data>

Or, if you use a recordset to produce the XML file.

Try adding a new record using rs.addnew, then save as XML.

If you open the file in notepad, you will see the difference between new and
existing records.

Signature

roger

William Vaughn [MVP] - 30 Apr 2008 17:57 GMT
I can think of a half-dozen ways off the top of my head to do this and using
this approach would not be on the list--not even close.
I suggest using Bulk Copy, Detach/Attach, SSIS script, Backup/Restore,
Synchronization or ADO.NET SqlBulkCopy. But XML to Recordsets?

Signature

__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205  (Pacific time)
Hitchhiker’s Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________

> My company has a VB6 application that accesses SQL Server 2005. Our
> consultants demo this application from laptops that have SQL Express
[quoted text clipped - 38 lines]
>
> Jim Leach
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.