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.

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

Cor
Tue Aug 02 07:14:02 CDT 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



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

Miha
Tue Aug 02 09:28:08 CDT 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" <ZadiFriedrich@discussions.microsoft.com> wrote in message
news:0F1D8670-F30A-44F7-9BF7-1381CCF0629B@microsoft.com...
> 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.



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

Paul
Tue Aug 02 09:49:05 CDT 2005

On Tue, 2 Aug 2005 04:51:01 -0700, "Zadi Friedrich" <ZadiFriedrich@discussions.microsoft.com> 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/default.asp?url=/library/en-us/dnacc2k/html/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)

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

Cor
Tue Aug 02 11:36:22 CDT 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



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

Paul
Tue Aug 02 12:54:05 CDT 2005

On Tue, 2 Aug 2005 18:36:22 +0200, "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> 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)

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

Cor
Tue Aug 02 14:21:23 CDT 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



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

Paul
Wed Aug 03 08:53:18 CDT 2005

On Tue, 2 Aug 2005 21:21:23 +0200, "Cor Ligthert [MVP]" <notmyfirstname@planet.nl> 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)