473,508 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving data between Access databases

I have two Access databases: one has records, the other only has blank
tables. I want to copy records to the empty database. I am using a
DataAdaptor and a DataSet for the transfer. My code works for for editing
records or using the Row.ADD() method to append records.

To transfer the records, I have tried the code shown below and variations of
it. The code does not cause an exception but does not transfer the records
either. What code structure should I use for this task?

Dim sSQL As String = "Select * From Publishers"
Dim oleConnLoad As New
OleDb.OleDbConnection(gsConnectionStringLoad)
Dim oleConnSave As New
OleDb.OleDbConnection(gsConnectionStringSave)
Dim oleDALoad As New OleDb.OleDbDataAdapter(sSQL, oleConnLoad)
Dim oleDASave As New OleDb.OleDbDataAdapter(sSQL, oleConnSave)
Dim oDSLoad As New DataSet
Dim oDSSave As New DataSet
oleDALoad.Fill(oDSLoad, "Publishers")
oleDASave.Fill(oDSSave, "Publishers")

Dim oCmdBuilder As New OleDb.OleDbCommandBuilder(oleDASave)
oCmdBuilder.QuotePrefix = "["
oCmdBuilder.QuoteSuffix = "]"
oleDASave.InsertCommand = oCmdBuilder.GetInsertCommand
oleDASave.DeleteCommand = oCmdBuilder.GetDeleteCommand
oleDASave.UpdateCommand = oCmdBuilder.GetUpdateCommand
oDSSave.Merge(oDSLoad)
oleDASave.Update(oDSSave, "Publishers")


Nov 21 '05 #1
1 2842

"genojoe" <ge*****@discussions.microsoft.com> schrieb im Newsbeitrag
news:DE**********************************@microsof t.com...
I have two Access databases: one has records, the other only has blank
tables. I want to copy records to the empty database. I am using a
DataAdaptor and a DataSet for the transfer. My code works for for editing
records or using the Row.ADD() method to append records.

To transfer the records, I have tried the code shown below and variations of it. The code does not cause an exception but does not transfer the records either. What code structure should I use for this task?

Dim sSQL As String = "Select * From Publishers"
Dim oleConnLoad As New
OleDb.OleDbConnection(gsConnectionStringLoad)
Dim oleConnSave As New
OleDb.OleDbConnection(gsConnectionStringSave)
Dim oleDALoad As New OleDb.OleDbDataAdapter(sSQL, oleConnLoad)
Dim oleDASave As New OleDb.OleDbDataAdapter(sSQL, oleConnSave)
Dim oDSLoad As New DataSet
Dim oDSSave As New DataSet
oleDALoad.Fill(oDSLoad, "Publishers")
oleDASave.Fill(oDSSave, "Publishers")

Dim oCmdBuilder As New OleDb.OleDbCommandBuilder(oleDASave)
oCmdBuilder.QuotePrefix = "["
oCmdBuilder.QuoteSuffix = "]"
oleDASave.InsertCommand = oCmdBuilder.GetInsertCommand
oleDASave.DeleteCommand = oCmdBuilder.GetDeleteCommand
oleDASave.UpdateCommand = oCmdBuilder.GetUpdateCommand
oDSSave.Merge(oDSLoad)
oleDASave.Update(oDSSave, "Publishers")

Hi,

i use this
http://www.planet-source-code.com/vb...3514&lngWId=10
and read this xml-file into the second access database.

Greeting

Thomas
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5365
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access...
3
4479
by: Rock2005 | last post by:
Hi All, I have a hard drive that fails to boot with some mysql 4.1 data I would like to keep. Have slaved that drive to another PC (with mysql 4.1.12 loaded) and have saved other data and am able...
4
1253
by: LaSalamandra | last post by:
have a dedicated web server with Win2000 and CF MX Server. I always used ACCESS databases. Now, I bought a space under a MS SQL Server and I'm moving all my databases there. Today I moved my...
9
7250
by: Daven Thrice | last post by:
If I have a fairly big Access MDB, that is relational, and has, say, 100 objects (forms, reports, modules, etc.), what is the path to get this database "online". Is there a way to put the tables...
7
1861
by: Alex | last post by:
Hi all, I've been writing in ColdFusion for about 6 years now, and now that we've installed a Sharepoint Portal Server I'm finding that I need to use ASP.Net to make database calls. I'm finding...
6
1451
by: Woody Splawn | last post by:
I have been using SQL Server 2000 on my stand-alone machine as a back-end to a VS.net application. It is time to switch environments and take the application to the customer. I need to install...
34
5001
by: Karam Chand | last post by:
Hello I have been working with Access and MySQL for pretty long time. Very simple and able to perform their jobs. I dont need to start a flame anymore :) I have to work with PGSQL for my...
9
3070
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
2
3253
by: Orit | last post by:
Hello . Please find below my questions - I hope some of the ASP.NET experts of this forum will answer to those beginner's questions : My Web site should be able to work with either SQL Server...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5624
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.