| | |
Backup of sql server using vb.net code
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Jun 2008
Posts: 10
Reputation:
Solved Threads: 0
Dim strSql As String
strSql = " set quoted_identifier off "
strSql &= " declare @strSql varchar(150) "
strSql &= " set @strSql = ""BackUp database SWAMC to disk = 'D:\SWAMC"" + Convert(varchar, getdate(), 112) + Replace(Convert(varchar, getdate(), 108), "":"", """") + "".dbb' with init,skip"""
strSql &= " print @strSql"
strSql &= " exec (@strSql) "
strSql &= "set quoted_identifier on "
Dim SqlCmd As New SqlClient.SqlCommand(strSql, con)
SqlCmd.ExecuteNonQuery()
this give me error in taking backup
Plz help me...................................
strSql = " set quoted_identifier off "
strSql &= " declare @strSql varchar(150) "
strSql &= " set @strSql = ""BackUp database SWAMC to disk = 'D:\SWAMC"" + Convert(varchar, getdate(), 112) + Replace(Convert(varchar, getdate(), 108), "":"", """") + "".dbb' with init,skip"""
strSql &= " print @strSql"
strSql &= " exec (@strSql) "
strSql &= "set quoted_identifier on "
Dim SqlCmd As New SqlClient.SqlCommand(strSql, con)
SqlCmd.ExecuteNonQuery()
this give me error in taking backup
Plz help me...................................
•
•
Join Date: Jan 2008
Posts: 1
Reputation:
Solved Threads: 0
Hi,
When trouble shooting VB & SQL I always find it easier to formulate my string variable "strSql" and then output this text to a text message.
Then copy this text string and manually run the string using T-SQL or from the SQL 2005 interface.
This will show if your syntax is being assembled correctly by pointing out where the SQL server is having a problem with the command.
If it runs OK manually, then that would mean that you are not sending it over to SQL in the proper format and you may have issues with " or ' or ''' other related formatting & spacing issues.
Good luck..!
MJ
When trouble shooting VB & SQL I always find it easier to formulate my string variable "strSql" and then output this text to a text message.
Then copy this text string and manually run the string using T-SQL or from the SQL 2005 interface.
This will show if your syntax is being assembled correctly by pointing out where the SQL server is having a problem with the command.
If it runs OK manually, then that would mean that you are not sending it over to SQL in the proper format and you may have issues with " or ' or ''' other related formatting & spacing issues.
Good luck..!
MJ
![]() |
Similar Threads
- program code about log in information using java JFrame (Java)
- trojans...now nothing opens and I get a paint can't open error (Viruses, Spyware and other Nasties)
- HijackThis Log help, Terrible Virus/Malware (Viruses, Spyware and other Nasties)
- Cant Load Symantec Antivirus (Viruses, Spyware and other Nasties)
- Infected, Please help!!! (Viruses, Spyware and other Nasties)
- Source Code Sale (IT Professionals' Lounge)
- Aurora Nightmares- please help (Viruses, Spyware and other Nasties)
- hover over text tips (JavaScript / DHTML / AJAX)
- RedHat Network Server (*nix Hardware Configuration)
Other Threads in the VB.NET Forum
- Previous Thread: Notepad using vb.net
- Next Thread: Data not being displayed correctly on datagridview
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account add application array basic beginner browser button buttons center check click code combo cpu crystalreport cuesent database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade file-dialog filter forms ftp generatetags html images input insert intel listview mobile module monitor mysql net number open output panel passingparameters picturebox picturebox2 port print printing printpreview problem regex reuse right-to-left searchvb.net select settings shutdown socket sqldatbase sqlserver storedprocedure survey tcp temperature textbox timespan transparency trim txttoxmlconverter user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet vista visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





