Hello,
I am Using VB 6.0 . Please Help me to get the codes to Create Backup and Restore in SQL server 7.0. I request Some one to help me at the earliest.
Rajesh
Hello,
I am Using VB 6.0 . Please Help me to get the codes to Create Backup and Restore in SQL server 7.0. I request Some one to help me at the earliest.
Rajesh
Practical clarification and a compact VB6 pattern to fill gaps in this thread (building on ’s note about missing help and ’s difficulty).
Query Analyzer and Enterprise Manager both accept the Transact-SQL backup/restore statements described in Books Online; if those topics do not appear in Help then Books Online probably wasn’t installed with the client tools. The easiest immediate options are: use Enterprise Manager’s GUI to create a backup, install the SQL Server Books Online help, or run the T-SQL from Query Analyzer / a programmatic connection.
Key checklist before running backups/restores from VB6:
VB6 execution pattern (ADODB) — insert the appropriate T-SQL statement in the tsql string:
' VB6: open a connection, execute T-SQL (backup/restore), handle Errors collection
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.Open "Provider=SQLOLEDB;Data Source=SERVERNAME;Initial Catalog=master;Integrated Security=SSPI;"
Dim tsql As String
tsql = "<place the T-SQL backup or restore statement here>"
On Error GoTo ErrHandler
cn.Execute tsql
cn.Close
Set cn = Nothing
Exit Sub
ErrHandler:
Dim i As Integer
For i = 0 To cn.Errors.Count - 1
Debug.Print cn.Errors(i).Number & ": " & cn.Errors(i).Description
Next i
If Not cn Is Nothing Then cn.Close: Set cn = Nothing Troubleshooting notes: check the SQL Server error log for filesystem/permission errors, verify the service account, and run the same command directly in Query Analyzer to get clearer error messages. For scheduled or repeatable backups prefer a SQL Agent job (or an OS scheduled task calling a script) so credentials and paths are consistent.
Jump to Post— AV Manoharan 0If you are using SQL Server in you computer please switch on the Query Analyzar. It will ask you the user name nd password. If both are sa fine.
Pull down the Help menu Choose its index. On the Blank space just type in Bacup and choose Backup(Described). Click Display.
…
Jump to Post— AV Manoharan 0In the help menu you have to click the first option ie Contents and Index. F1 key or AltC will not work. If nothing is displayed please reply to me I will give you the syntax
Jump to Post— AV Manoharan 0I do not know what has happened. Actually I have replied to you, but could not find on the thread. So again I am Posting.
During Installation of SQL it ask for add-ons. I don't know what has happened. Anyhow, please find the code below. There are so many …
If you are using SQL Server in you computer please switch on the Query Analyzar. It will ask you the user name nd password. If both are sa fine.
Pull down the Help menu Choose its index. On the Blank space just type in Bacup and choose Backup(Described). Click Display.
You have all the choices on the right pane.
Same way for restore also.
If you can't understand anything, please replay to this thread.
hi Manoharan,
thanx for ur reply. where are u from ? I'll try with the adices that u gave me and wiull get back to u later.
Rajesh
how take backup using vb code
Dear Manoharan, I tried as per your advice with query analyzer but i couldnt find Any backup or restore option in help index.Pls help me to proceed with this.
In the help menu you have to click the first option ie Contents and Index. F1 key or AltC will not work. If nothing is displayed please reply to me I will give you the syntax
Dear Manoharan,
I took SQL Server Querry Analyser Help and choose contents and index. and i typed the keyword Backup in the index but no such keyword appeared in the list. and the same was the case with restore pls advice what to do.
Rajesh
I do not know what has happened. Actually I have replied to you, but could not find on the thread. So again I am Posting.
During Installation of SQL it ask for add-ons. I don't know what has happened. Anyhow, please find the code below. There are so many options in that, but I hope that can wait for, in you case.
BACKUP DATABASE {database_name | @database_variable_name}
TO <device_name>
database_name can be the actual database or the actual database name containing in a @variable
The device names are either DISK or TAPE
If you are giving the TO option you have to append these device name with an equal to sign and the actual path and the file name to hold your backup.
eg.
TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\
Mydatabasebackup.dat'
same way the RESTORE
RESTORE DATABASE {database_name | @database_variable_name}
FROM <device_name>
All things are same as BACKUP.
Here the FROM option is followed by a = and the path and filename containing your backup.
So Simple Is it NOT?
Programing is like that dear. When you know the code, it is very simple, Otherwise ...., you know!
regards
AV Manoharan
Hi,
I have an issue on backing database on sql server 2005. It will not create a backup when the database is on the network. I will only backup when the database is on local host.
I've tried using SQLDMO but I also have problem with it. pls help.
Thank you in advance
, you will have to open your own thread. Nobody will reply on this if you have hijacked another members post and even worse, from 2007.:)
Post your new and own question and I will see if we can help. Also give us the current backup code you have...
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.