Hello everybody !!!

I have a problem that. When I back up using "Microsoft.SqlServer.Management.Smo". It works perfect on my PC. But when I bring it to another PC. It doesn't work at all.

Please give me some help!!!

The file attach below

WindowsApplication_BackUp.zip

Thanks for your helping !!!

Recommended Answers

All 11 Replies

Did you already installed the SQL Server Management Studio in the target computer?

Of course I installed SQL Server Management Studio, but it did not work.

Any message from SQL Server management studio not working on the target computer?
Is the SQL Server installed on the target computer? If yes, is the version installed on yours exacly the same than in the target, with the same patches applied?

Hello everybody !!!

I have a problem that. When I back up using "Microsoft.SqlServer.Management.Smo". It works perfect on my PC. But when I bring it to another PC. It doesn't work at all.

Please give me some help!!!

The file attach below

[ATTACH]23303[/ATTACH]

Thanks for your helping !!!

If you need VB.net code then code for taking backup is

Try
 Dim s As StreamWriter
Dim portfolioPath As String = My.Application.Info.DirectoryPath
If Not Directory.Exists("C:\Backup") Then
Directory.CreateDirectory("C:\Backup")
File.Create("C:\ Backup\PIS.Mdb").Close()
File.Create("C: \Backup\Backup log.rtf").Close()
s = New StreamWriter("C:\Backup\Backup log.rtf", True)
s.WriteLine("This backup was initially taken on - " & Date.Now)
                s.Flush()
                s.Close()
FileCopy(portfolioPath & "\PIS.mdb", "C:\Backup\PIS.Mdb")
s = New StreamWriter("C:\Backup\Backup log.rtf", True)
 MsgBox("New directory and backup file created")

for detail please visit http://ram-a-singh.blogspot.com/2011/12/how-to-take-backup-from-database-vbnet.html

@sirasingh: nndung179 said:

It works perfect on my PC

.

Wich are the prerequisites of your code in the target pc where will be deployed the application in order to work?

@lolafuertes: The target PC installed exactly the same as my SQL Server Management Studio version.

I would like to make the simple application back up full and restore database

@nndung179:The behaviour 'It doesn't work at all' is really not clarifying the kind of problem.
Did you tried to restore it maually in the targed PC to verify if there is any other problem?

@sirasingh: IMO your code works for Access databases, not for SQL Server ones.

@lolafuertes: It worked perfectly on my PC. I've tried in another PC => It didn't work at all.

@nndung179:The behaviour 'It doesn't work at all' is really not clarifying the kind of problem.
Did you tried to restore it maually in the targed PC to verify if there is any other problem?

@sirasingh: IMO your code works for Access databases, not for SQL Server ones.

I have not tried this code on SQL server but in my code nothing is there for Access database I have just copy my Access database name PIS.mdb to designated location.

http://ram-a-singh.blogspot.com/2011/12/how-to-take-backup-from-database-vbnet.html

Sorry again, but the phrase

It didn't work at all.

still not clarify the problem you have on 'another PC'.

Please be so kind to confirm if I am missing something:

On the target PC you installed the following:

  • SQL Server, the same edition you have on your machine with the same patch level, with the same instances than in your machine
  • .NET runtime required by your application

You already configured the server and client protocols in the target machine to support Shared Memory, TCP/IP and Named Pipes (and are configured in this order for the client)
Your program is connecting to the default instance of the SQL Server installed. (Is there a default instance on the targe machine or is installed with a named instance instead?)

You already created manually the database DANGKY in the target machine.

Then you install the program on the target computer and have no error during the install.

Then when you start your program in the target machine, nothing happens and no error is reported.

Is this the 'It didn't work at all'?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.