PC Review


Reply
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average.

Copy ms access tables from one DB to an other using ado.net in vb.

 
 
=?Utf-8?B?WmFkaSBGcmllZHJpY2g=?=
Guest
Posts: n/a
 
      2nd Aug 2005
Hi everyone,
I need to know how to copy a ms access table from database A to database B
using ado.net in vb.net. What classes of the OLEDB namespaces will allow me
to do this? Can you please provide a code sample?
Thanks for your help.
 
Reply With Quote
 
 
 
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      2nd Aug 2005
Zadi,

This can have an easy answer, you cannot. AdoNet does has no features to
create an ms access database. You can only access a database by using SQL
commands.

I hope this gives an idea.

Cor


 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      2nd Aug 2005
As Cor mentioned, there is no built in support for this.
You might use OleDbConnection.GetOleDbSchemaTable to get table metadata and
then use appropriate sql commands (or jet engine) to add this table
structure to another table.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

"Zadi Friedrich" <(E-Mail Removed)> wrote in message
news:0F1D8670-F30A-44F7-9BF7-(E-Mail Removed)...
> Hi everyone,
> I need to know how to copy a ms access table from database A to database B
> using ado.net in vb.net. What classes of the OLEDB namespaces will allow
> me
> to do this? Can you please provide a code sample?
> Thanks for your help.



 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      2nd Aug 2005
On Tue, 2 Aug 2005 04:51:01 -0700, "Zadi Friedrich" <(E-Mail Removed)> wrote:

¤ Hi everyone,
¤ I need to know how to copy a ms access table from database A to database B
¤ using ado.net in vb.net. What classes of the OLEDB namespaces will allow me
¤ to do this? Can you please provide a code sample?
¤ Thanks for your help.

The following code will copy tables and their data from one access database to another. However, it
will not create indexes or relationships. If you need to create those you will need to execute some
Access SQL DDL statements.

http://msdn.microsoft.com/library/de.../acfundsql.asp

Function ExportAccessToAccess() As Boolean

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [MS
Access;DATABASE=E:\My Documents\db10.mdb;].[Table1] FROM Table1", AccessConn)

AccessCommand.ExecuteNonQuery()
AccessConn.Close()

End Function


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      2nd Aug 2005
Paul,

As you probably well know, do I know that too, however that is not using
ADONET as the OP askes, that is using ADODB (What is posible to use in VS
Net).

Cor


 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      2nd Aug 2005
On Tue, 2 Aug 2005 18:36:22 +0200, "Cor Ligthert [MVP]" <(E-Mail Removed)> wrote:

¤ Paul,
¤
¤ As you probably well know, do I know that too, however that is not using
¤ ADONET as the OP askes, that is using ADODB (What is posible to use in VS
¤ Net).

Cor,

He was asking about using the OLEDB (System.Data.OleDb) namespace and not ADODB.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      2nd Aug 2005
Paul,

You are right, I misrelated your answer. The clue is that you export it to
an existing ms Access Database and I was even not reading completely your
message, used as I am to your AdoDB answer on this.

Your answer is correct.

:-)

Sorry

I am a little bit :-( about my reply to you.

Cor


 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      3rd Aug 2005
On Tue, 2 Aug 2005 21:21:23 +0200, "Cor Ligthert [MVP]" <(E-Mail Removed)> wrote:

¤ Paul,
¤
¤ You are right, I misrelated your answer. The clue is that you export it to
¤ an existing ms Access Database and I was even not reading completely your
¤ message, used as I am to your AdoDB answer on this.
¤
¤ Your answer is correct.
¤
¤ :-)
¤
¤ Sorry
¤
¤ I am a little bit :-( about my reply to you.
¤
¤ Cor
¤

No problem Cor. ;-)


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Access tables to Access Project with SQL Server tables Kaykayme Microsoft Access External Data 5 26th Jan 2009 07:59 PM
Copy linked tables in access =?Utf-8?B?U3Vuc2hpbmU=?= Microsoft Access External Data 3 8th Dec 2005 07:56 PM
Copy tables from Oracle to Access FAST? Troy McLure Microsoft ADO .NET 2 2nd Nov 2005 12:03 AM
VB.net code to copy tables or queries from one access db to anothe =?Utf-8?B?Qm9i?= Microsoft VB .NET 1 19th Jul 2005 04:41 PM
Copy MS:Access tables... Nick Jacobs Microsoft ADO .NET 2 30th Jan 2004 02:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:28 AM.