HighTechTalks DotNet Forums  

Re: Replacing tables in SQL EXPRESS

Dotnet Framework (ADO.net) microsoft.public.dotnet.framework.adonet


Discuss Re: Replacing tables in SQL EXPRESS in the Dotnet Framework (ADO.net) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Michel
 
Posts: n/a

Default Re: Replacing tables in SQL EXPRESS - 09-08-2007 , 01:06 PM






Hello,

Thank you very much for your reply.
If I understand correctly SqlBulkCopy can only add rows from one table to
another. What I want is just replace one table by another (perhaps delete
the table to be replaced first).
When I delete the rows of the table, I get an error that I want to import
duplicate values (e.g. the key values of the table). When I delete the
entire table first, SqlBulkCopy gives an error that th destination table is
not found.

How can I fix that?

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel


"William Vaughn" wrote:

Quote:
Michel,
Check out the SqlBulkCopy method in ADO.NET 2.0. It can copy an entire
table in a single (high-speed) operation. I have an example of its use in my
book.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant, Dad, Grandpa
Microsoft MVP
INETA Speaker
www.betav.com
www.betav.com/blog/billva
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-----------------------------------------------------------------------------------------------------------------------

"Michel" <Michel (AT) discussions (DOT) microsoft.com> wrote in message
news:84F967B5-08BF-4E23-9C73-A19AFE8A978B (AT) microsoft (DOT) com...
Hello,

Can someone please set me on the way on how to replace certain tables in a
(new) SQL EXPRESS database file by tables of the same name in another
(target) SQL EXPRESS database file?
I would like to do this through code in VB.NET 2005. I presume I have to
use ADO.NET 2.0 code.
Is it correct I first have to delete the original table in the target
database by a DROP statement and the copy the new table into the target
database? Or do I use a DELETE statement and the fill the empty database
by
the new data?
Do I need a second connection to the database with the new tables?
I am a newbie in this matter, so any help would greatly be appreciated.
Also lins to usefull example code is welcome.
I searched already for info on the internet, but mostly the information I
found is not very usefull for my purpose.

Many thanks and greetings from Brugge (Bruges - Belgium),

Michel




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.