my Application is exist in source Code folder.This folder contain the space.for examp

swagatika

New member
Joined
Feb 22, 2008
Messages
3
Programming Experience
1-3
VB.NET:
If rdoRestore.Checked = True Then

Try

Dim oSQLServer As SQLDMO._SQLServer = New SQLDMO.SQLServerClass

Dim oRestore As SQLDMO.Restore = New SQLDMO.RestoreClass

Dim aString As String

path = System.IO.Directory.GetCurrentDirectory

aString = (path & "\Allfiles\Database\SensorNET_Backup")

MsgBox(aString)

oRestore.Files = aString

oRestore.Database = "SensorNET"

oRestore.ReplaceDatabase = True

oSQLServer.Connect(cboServerName.Text, txtUserName.Text)

oRestore.SQLRestore(oSQLServer)

MsgBox("Database is Restored")

Catch err As Exception

MsgBox(err.Message())

End Try

End If


i will display the error:-



BackupDiskFile:penMedia: Backup device 'C:\AppTest_working_folder\SensorNET_FinalRelease_20080220\Source' failed to open. Operating system error = 2(The system cannot find the file specified.).
2008-02-24 22:36:12.22 spid51 BackupDiskFile:penMedia: Backup device



because

my Application is exist in source Code folder.This folder contain the space.for example "Source Code"



can u help me?
 
Last edited by a moderator:
Space In File Path Issue with SQLDMO application

Hi Swagatika,

Just follow the link first :http://sqldev.net/sqldmo/SQL-DMO-FAQ.htm

You will get the clear solution.

Everything is fine.

Just conecatenate square bracket before and after the string.

So ur file path output must be like this as below :

1."[" & path & "\folder Path\a.bak]"

2."[" & C:/Folder Path/filename.bak & "]"

3.oBackup.Files = "[C:\Program Files\Microsoft SQL Server\80\MSSQL\Backup\pubs.bak]"

I hv tested. It works and takes space in file path.

Thanks
Ajit
 
Back
Top