Click here to Skip to main content
16,005,339 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRich Text Box Pin
Socheat.Net3-Jan-08 19:44
Socheat.Net3-Jan-08 19:44 
GeneralRe: Rich Text Box Pin
nishkarsh_k3-Jan-08 22:14
nishkarsh_k3-Jan-08 22:14 
GeneralRe: Rich Text Box Pin
Socheat.Net4-Jan-08 14:28
Socheat.Net4-Jan-08 14:28 
GeneralAutomatically installation of .net framework Pin
xbiplav3-Jan-08 18:53
xbiplav3-Jan-08 18:53 
GeneralRe: Automatically installation of .net framework Pin
Nilesh Hapse3-Jan-08 21:35
Nilesh Hapse3-Jan-08 21:35 
GeneralRe: Automatically installation of .net framework Pin
nishkarsh_k3-Jan-08 22:04
nishkarsh_k3-Jan-08 22:04 
GeneralBackup & Restore Database Pin
vaani3-Jan-08 18:51
vaani3-Jan-08 18:51 
GeneralRe: Backup & Restore Database Pin
John_Adams4-Jan-08 1:52
John_Adams4-Jan-08 1:52 
Hi Vaani,

I do not have expertise on restoring SQL Server database programmatically. Howerver, you may try following code snippet to take backup of a SQL SERVER database from a remote machine. You will need to compile it and change the values to reflect your server.

BEGIN CODE

Imports System
Imports System.Data
Imports System.Collections

Imports Microsoft.SqlServer.Management.Common
Imports Microsoft.SqlServer.Management.Smo

Class Program
Private Shared Sub Main(ByVal args As String())
Dim bdi As New BackupDeviceItem("AdventureWorks.bak", DeviceType.File)

Dim bu As New Backup()
bu.Database = "AdventureWorks"
bu.Devices.Add(bdi)
bu.Initialize = True
AddHandler bu.PercentComplete, AddressOf Backup_PercentComplete
AddHandler bu.Complete, AddressOf Backup_Complete

' add percent complete and complete event handlers

Dim server As New Server("localhost")
bu.SqlBackup(server)

Console.WriteLine(Environment.NewLine + "Press any key to continue.")
Console.ReadKey()
End Sub

Protected Shared Sub Backup_PercentComplete(ByVal sender As Object, ByVal e As PercentCompleteEventArgs)
Console.WriteLine(e.Percent + "% processed.")
End Sub

Protected Shared Sub Backup_Complete(ByVal sender As Object, ByVal e As ServerMessageEventArgs)
Console.WriteLine(Environment.NewLine + e.ToString())
End Sub
End Class

END CODE

I hope this would be helpful Smile | :) .

Regards,
John Adams
ComponentOne LLC

QuestionProduce reports. Any help plz? Pin
tellytub3-Jan-08 16:57
tellytub3-Jan-08 16:57 
GeneralRe: Produce reports Pin
Christian Graus3-Jan-08 17:17
protectorChristian Graus3-Jan-08 17:17 
GeneralRe: Produce reports Pin
tellytub3-Jan-08 21:23
tellytub3-Jan-08 21:23 
GeneralRe: Produce reports Pin
Christian Graus3-Jan-08 23:47
protectorChristian Graus3-Jan-08 23:47 
GeneralRe: Produce reports. Any help plz? Pin
Tom Deketelaere4-Jan-08 5:25
professionalTom Deketelaere4-Jan-08 5:25 
GeneralRe: Produce reports. Any help plz? Pin
tellytub4-Jan-08 23:13
tellytub4-Jan-08 23:13 
GeneralRe: Produce reports. Any help plz? Pin
Tom Deketelaere7-Jan-08 1:04
professionalTom Deketelaere7-Jan-08 1:04 
QuestionDisplay String With Quotes Pin
Dan Suthar3-Jan-08 15:05
professionalDan Suthar3-Jan-08 15:05 
GeneralRe: Display String With Quotes Pin
Christian Graus3-Jan-08 15:15
protectorChristian Graus3-Jan-08 15:15 
AnswerRe: Display String With Quotes Pin
Nilesh Hapse3-Jan-08 18:32
Nilesh Hapse3-Jan-08 18:32 
AnswerRe: Display String With Quotes Pin
Dan Suthar3-Jan-08 23:36
professionalDan Suthar3-Jan-08 23:36 
GeneralFill By Methods Vs. Binding Source Pin
AAGTHosting3-Jan-08 12:43
AAGTHosting3-Jan-08 12:43 
GeneralRe: Fill By Methods Vs. Binding Source Pin
Dave Kreskowiak3-Jan-08 14:24
mveDave Kreskowiak3-Jan-08 14:24 
Generala coding problem Pin
s3rro3-Jan-08 10:42
s3rro3-Jan-08 10:42 
GeneralRe: a coding problem Pin
Dave Kreskowiak3-Jan-08 10:58
mveDave Kreskowiak3-Jan-08 10:58 
GeneralRe: a coding problem Pin
Ray Cassick3-Jan-08 11:30
Ray Cassick3-Jan-08 11:30 
QuestionApplication exits without error message Pin
Volker Weichert3-Jan-08 9:06
Volker Weichert3-Jan-08 9:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.