DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sun, 19 Aug 2007 14:24:47 +0200,    posted on: microsoft.public.dotnet.framework.adonet        back       

Thread Index
  1    Michel Vanderbeke
          2    William Vaughn


Copying tables in SQLEXPRESS   
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




>Yes, you can use SMO to achieve what you desire. (SQL Management Objects).
>You can also script out the DDL and run it.
>
>... provided the acount you are doing this under has sufficient privileges
>(both SMO or DDL).
>
>-- 
>Gregory A. Beamer
>MVP, MCP: +I, SE, SD, DBA
>
>*************************************************
> Think outside the box!                           |
>*************************************************

>>"Michel Vanderbeke"  wrote in message
>>news:46c44d97$0$13859$ba620e4c@news.skynet.be...
>> Hello,
>>
>> I have a program, running in several places, using SQLEXPRESS as 
>> database.
>> The different places are stand-alone, and not connected to a network.
>> Regulary, I have to apply changes on certain tables of the database.
>>
>> In a previous program, written in VB6 with an Access database, I used JRO
>> through VB6-code to delete the table in the different databases and to
>> copy
>> the new one.
>>
>> Is something similar possible with SQLEXPRESS.  I would like to be able 
>> to
>> update tables in an SQLEXPRESS database file by deleting them and replace
>> them with the new table.  Is this possible through VB.NET code?
>>
>> Many thanks and greetings from Brugge (Bruges - Belgium),
>>
>> Michel
Date:Sun, 19 Aug 2007 14:24:47 +0200   Author:  

Re: Copying tables in SQLEXPRESS   
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)
-----------------------------------------------------------------------------------------------------------------------

"Michel Vanderbeke"  wrote in message 
news:46c836a1$0$13862$ba620e4c@news.skynet.be...

> 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
>
>
>
>>Yes, you can use SMO to achieve what you desire. (SQL Management Objects).
>>You can also script out the DDL and run it.
>>
>>... provided the acount you are doing this under has sufficient privileges
>>(both SMO or DDL).
>>
>>-- 
>>Gregory A. Beamer
>>MVP, MCP: +I, SE, SD, DBA
>>
>>*************************************************
>> Think outside the box!                           |
>>*************************************************
>
>>>"Michel Vanderbeke"  wrote in message
>>>news:46c44d97$0$13859$ba620e4c@news.skynet.be...
>>> Hello,
>>>
>>> I have a program, running in several places, using SQLEXPRESS as 
>>> database.
>>> The different places are stand-alone, and not connected to a network.
>>> Regulary, I have to apply changes on certain tables of the database.
>>>
>>> In a previous program, written in VB6 with an Access database, I used 
>>> JRO
>>> through VB6-code to delete the table in the different databases and to
>>> copy
>>> the new one.
>>>
>>> Is something similar possible with SQLEXPRESS.  I would like to be able 
>>> to
>>> update tables in an SQLEXPRESS database file by deleting them and 
>>> replace
>>> them with the new table.  Is this possible through VB.NET code?
>>>
>>> Many thanks and greetings from Brugge (Bruges - Belgium),
>>>
>>> Michel
>
> 
Date:Sun, 19 Aug 2007 15:24:07 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us