473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Permission denide error in ASP

Hi
i hava wrote the code to restore a file of SQL server
database through ASP.It can access the backup file on
server and restored but some times or in some systems it
gives error like permission denide.What is the reason for
that.
Here is the code:

<!--#Include File="Connect.inc"-->

<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Intranet FTP&SQL Server Control</title>
</head>

<body>
<%
n1=request.querystring("nn1")
n2=request.querystring("nn2")
nd=request.querystring("nn3")
nt=request.querystring("nn4")

Set srv=Server.CreateObject("SQLDMO.SQLServer")
srv.Connect "server", "sa","thanks"
'Set Conn = Server.CreateObject("ADODB.Connection")
'DSNtest="DRIVER={SQL
Server};SERVER=SERVER;UID=sa;PWD=thanks;DATABASE=p arameter"
'Conn.open DSNtest
set rs=conn.execute("select * from tbl_parameter where
Databasename like '"& n1 &"' ")
while not rs.EOF
n3=rs("PathonDevelopment")
rs.movenext
wend

Set rest=Server.CreateObject("SQLDMO.Restore")
rest.Action=0 ' full db restore
rest.Database= n1
strpath=n3 & n1 & "\" & n2
rest.Files ="["&strpath&"]"
'rest.Files =strpath
'response.write(rest.Files)
rest.ReplaceDatabase=True 'Force restore over existing
database

Dim objFSO , objDrive , drive
'create an instance of FileSystemObject
Set objFSO = Server.CreateObject
("Scripting.FileSystemObject")
'Set objDrive = objFSO.Drives

For Each drive in objFSO.Drives
if not drive="A:" then
Set objFolder = objFSO.GetFolder(drive&"\")
'Response.Write(drive)
for each folder in objFolder.subfolders

for each folder_main in folder.subfolders

for each folder_sub in folder_main.subfolders
for each folder_files in folder_sub.subfolders

if folder_files.name = "Data" then

rest.RelocateFiles = "["&n1&"_Data]" & "," & _
"["&folder_sub&"\Data\"&n1&".mdf]" & "," & _
"["&n1&"_Log]" & "," & _
"["&folder_sub&"\Data\"&n1&"_log.ldf]"

exit for
end if
next

next
next
next
end if
next
rest.SQLRestore(srv)

set rs3=conn.execute("select * from tbl_Status")
dim count
cont=0
while not rs3.EOF
count=count+1
rs3.MoveNext
wend
set rs3=nothing
set rs3=conn.execute("select * from tbl_Status")
while not rs3.EOF
strrs3=rs3(0)
rs3.movenext
wend
if count >=9 then
set rs2=conn.execute("delete from tbl_Status where Status
like '"& strrs3 &"'")
strmsg=n2&" database file restored on development server
at "& time & " on " & date
set rs1=conn.execute("insert into tbl_Status(Status)values
('"&strmsg&"')")
response.redirect("index.asp")
else
strmsg=n2&" database file restored on development server
at "& time & " on " & date
set rs1=conn.execute("insert into tbl_Status(Status)values
('"&strmsg&"')")
response.redirect("index.asp")

end if

set rest=nothing
set srv=nothing

set rs=nothing
set rs1=nothing
set rs2=nothing
set rs3=nothing
set Conn=nothing
%>
</body>

</html>

or some times it gives error like,path not found at the
time of getting folders from drives.What the mistake
happen in my code.
Please give me a qucik solution,because this is very
urgent for me.
Thanks in advance

Mamatha
Nov 21 '05 #1
0 983

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application...
1
by: Benny | last post by:
Dear All, My ASP-MS Access application works fin in our local server and in our hosting I get this errors, while adding/editing or deleteing. When deleting a product: error Microsoft VBScript...
12
by: Russ | last post by:
Hello. My new dev machine is running XP Pro. In the past all equipment has only used Windows 2000. I have had a lot of problems getting my projects up and running on the new machine. The current...
10
by: Florian G. Pflug | last post by:
Hi I installed a postgres-application (which was developed on debian woody) on red hat 9 today, using the postgres 7.3 rpms from redhad. One of my the triggers uses the pg_settings table (more...
2
by: Taishi | last post by:
New user of SQL Everything is on the same machine My error is close to the bottom After reading it today, I can see there is a problem with 2 dbases 'PUBS' and 'Master' There are also some...
0
by: Mamatha | last post by:
Hi i hava wrote the code to restore a file of SQL server database through ASP.It can access the backup file on server and restored but some times or in some systems it gives error like permission...
4
by: stephen | last post by:
Hi, I am getting an error while trying to create an excel file. "Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
0
by: debug03 | last post by:
I am executing a DTS package on a Windows 2000 sp4 server running SQL Server 2000 and IBM DB2 V7 client. The DTS package source data(SQL Server) is selected from SQL server table and inserts data to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.