Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 taking sql database back frm dotnet

Author  Topic 

svibuk
Yak Posting Veteran

62 Posts

Posted - 2009-07-24 : 08:16:09
with refernece to http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=99193

need help in
a.Database = dbName
a.Files = path & BACKUP_FILE
a.BackupSetName = dbName
as to is dbname harcoded?
how to set the path & BACKUP_FILE
whts BackupSetName

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-24 : 08:45:15
[code]
Dim oSQLServer As New SQLDMO.SQLServer
Dim oBackup As New SQLDMO.Backup
Dim oRestore As New SQLDMO.Restore
Dim BACKUPFILE As String
Dim DATABASE As String

BACKUPFILE = "C:\" & ProjectFolder & "\VoiceNet_TemplateBackup.bkp"

DATABASE = "VoiceNet_at0000"

With oBackup
.Files = BACKUPFILE
.Database = DATABASE
.BackupSetName = "VoiceNet"
.BackupSetDescription = "Backup from VB.NET application"
.oSQLServer.Connect("NINEL-D246655F1", "timecontroluser", "timecontroluser")
.SQLBackup(oSQLServer)
End With

oSQLServer.DisConnect() [/code]

-------------------------
R..
Go to Top of Page

svibuk
Yak Posting Veteran

62 Posts

Posted - 2009-07-24 : 08:50:41
i am using this
i amnot getting any error but
not getting any backyp

Dim a As SQLDMO.Backup
Dim svr As SQLDMO._SQLServer
Try
a = New SQLDMO.BackupClass()
svr = New SQLDMO.SQLServerClass()

svr.LoginSecure = False
svr.Connect(ServerName, USER_n, pwd)
MsgBox("connected successfully")
a.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database
a.Database = dbName
a.Files = "c:\backup\" & "databkup"
a.BackupSetName = dbName
a.BackupSetDescription = "Database backup"
a.Initialize = True
a.SQLBackup(svr)

svr.DisConnect()
svr = Nothing
Catch ex As Exception
'MessageBox.Show(ex.ToString)
End Try
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-24 : 08:59:49
Dim a As SQLDMO.Backup
Dim svr As SQLDMO._SQLServer
Try
a = New SQLDMO.BackupClass()
svr = New SQLDMO.SQLServerClass()

svr.LoginSecure = False
svr.Connect(ServerName, USER_n, pwd)
MsgBox("connected successfully")
a.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database
a.Database = dbName
a.Files = "c:\backup\DatabaseBackup.bkp"
a.BackupSetName = dbName
a.BackupSetDescription = "Database backup"
a.Initialize = True
a.SQLBackup(svr)

svr.DisConnect()
svr = Nothing
Catch ex As Exception
'MessageBox.Show(ex.ToString)
End Try

-------------------------
R..
Go to Top of Page

svibuk
Yak Posting Veteran

62 Posts

Posted - 2009-07-24 : 09:05:16
done the same
butthe backup folder is blank

how do i check if its taking the databse or no
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-24 : 09:06:54
Hi

can you confirm.. where did you check..local machine or server machine..



-------------------------
R..
Go to Top of Page

svibuk
Yak Posting Veteran

62 Posts

Posted - 2009-07-25 : 08:03:57
its server
& i have given the instance name of the server
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2009-07-26 : 07:26:05
Try this
a.Files = "\\servername\backup\DatabaseBackup.bkp"
Go to Top of Page
   

- Advertisement -