Copying tables in SQLEXPRESS

  • Thread starter Thread starter Michel Vanderbeke
  • Start date Start date
M

Michel Vanderbeke

Hello,

Thank you for your help.

When I browse the internet, I only find examples on how to restore an entire
database.
What I try to achieve is to replace only one or several tables in the
database by updated tables from another database.

I added the reference to Microsoft.SqlServer.Smo and to
Microsoft.sqlServer.ConnectionInfo to my project.

In an example, I found following code:
Dim svr As Server = New Server() '

Dim res As Restore = New Restore()

res.DeviceType = DeviceType.File

===> this line gives an ERROR: DeviceType is not a member of
Microsoft.SqlServer.Management.Smo.Restore

res.Devices.Add("C:\Kassasysteem\Kassasysteem.mdf")

===> this line gives an ERROR: Value of type 'String' cannot be converted
to Microsoft.SqlServer.Management.Smo.BackupDeviceItem

res.Database = "Kassasysteem"

res.ReplaceDatabase = True

res.PercentCompleteNotification = 10

AddHandler res.PercentComplete, AddressOf ProgressEventHandler

res.SqlRestore(svr)


Can you please help me to fix this errors and explain to me how I can
restore only a few tables from a database and not the entire database?

Many thanks,

Michel
 
Check out SqlBulkCopy

--
____________________________________
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)
-----------------------------------------------------------------------------------------------------------------------
 
Back
Top