I would make csv export files and pass them via http BACK TO YOU. What your are attempting to do will not work at the hosted server.
......................... Stephen Russell - Senior Visual Studio Developer, DBA Memphis, TN 901.246-0159 > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Question Boy > Sent: Wednesday, April 01, 2009 5:05 PM > To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web > Services,.NET Remoting > Subject: [DotNetDevelopment] Use ASP to backup SQL Server Db > > > I am trying to help a colleague to backup his website to migrate it > elsewhere. As such, I am trying to figure out how I can using ASP > perform a backup to my hard drive of the entire db (it is actually > very small). > > The host is being more than difficult to work with. They were asked > for a backup and they refused to provide one. So now I am trying to > find a way to do it myself. > > I have been trying to use the following but it doesn't seem to produce > any results? > > <% > SQL_Server_Name = "servername" > DB_Name = "dbname" > DB_User_ID = "username" > DB_Password = "password" > strcon = "Provider=SQLOLEDB;Data Source="& SQL_Server_Name > &";Initial Catalog=" & DB_Name &";User ID="& DB_User_ID &";Password="& > DB_Password&";charset=utf-8" > set con = Server.CreateObject("ADODB.Connection") > con.Open strCon > sql="BACKUP DATABASE ["& DB_Name &"] TO DISK = N'c:/db.bak' WITH > NOFORMAT, NOINIT, NAME = N'backup', SKIP, NOREWIND, NOUNLOAD, STATS = > 10" > con.Execute(sql) > %> > > Since I am running the script on the server, so I suppose it is being > saved to the server rather than on my hard drive. What do I need to > do to be able to save it to my drive or e-mail it or so method I can > actually get a copy? > > Also worth explaining. The website files are hosted on one server > while the db is on another. So the Backup file is not on the local > computer with the asp files... I tried to add an e-mail routine but > the server running the asp file cannot locate the file (as it is > actually on another machine). > > Please keep in mind I know next to nothing about both SQL Server and > ASP. I truly am just trying to help someone who is completely > technologically ignorant out of a mess. > > Also, I am using the credentials given by the Host. Is there a > simple way to find out if they have the required permissions to > perform a backup? I was simply wondering if it wasn't a permission > issue. > > I have also tried to connect my server (SQL Server 2008) to the remote > server using the supplied credentials, but it doesn't work and returns > an error #53...? > > Thank you very much for your help!!! > > QB > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.0.238 / Virus Database: 270.11.35/2034 - Release Date: > 04/01/09 06:06:00
