| |

VerySource

 Forgot password?
 Register
Search
View: 723|Reply: 3

How to restore the database in VB

[Copy link]

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-3 15:40:01
| Show all posts |Read mode
I want to implement the backup and restore function of MS-SQL database in VB. The backup is made ~~

Backup I called a stored procedure "back_cpxs" to backup, here is the code
Dim cnn As ADODB.Connection
     Set cnn = New ADODB.Connection
     cnn.Open ConnectString
    cnn.Execute "exec back_cpxs '"&lujing&"'"
    cnn.Close

When recovering the database, I also called the stored procedure recovery, but it was prompted that the current database is in use and cannot be recovered
How can I achieve database recovery?
Reply

Use magic Report

0

Threads

6

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 South Africa

Post time: 2020-1-5 14:03:01
| Show all posts
-Use the following statement to first kill the process of accessing this database
declare @ss varchar (8000)

Select @ ss = isnull (@ss, '') + 'kill' + Cast (spid as varchar)
 from master..sysprocesses where dbID = db_id ('library name')
exec (@ss)
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-8-5 22:45:02
| Show all posts
Kil access to the database?
I’m a rookie~~ Can you tell me more
Reply

Use magic Report

1

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-8-8 09:30:01
| Show all posts
Master, come and help
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list