473,406 Members | 2,345 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,406 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 925

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: David Berman | last post by:
Hello, I'm receiving an error reading the machine.config file when I try to access my web application. This error came out of nowhere. After searching many sites, googelizing and searching here,...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.