Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2009, 12:47 PM
Registered User
 
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error In ASP Code

<!-- #include file="Connectionstring.asp" -->
<%

' variables
dim dcnDB 'Connection String
dim rsQuery 'Record Set
dim FacultyID 'Faculty Id For Faculty Members
dim Password 'Password For Faculty Members
dim Department 'Department Of The Faculty Members
dim FullName 'Name of The Faculty Members



'store form input into variables
FacultyID = Request.Form("FacultyID")
Password = Request.Form("Password")
Department=Request.Form("Department")
FullName=Request.Form("FullName")

' Code To Handle Error Code


' execute sql and open as recordset

Set dcnDB = Server.CreateObject("ADODB.Connection")

dcnDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.MapPath ("DATABASE\Database.mdb")
dcnDB.Open

Set rsQuery = Server.CreateObject("ADODB.Recordset")

rsQuery.open "SELECT * FROM FacultyRecord",_
dcnDB,3,3

'Check if facultyid doesn't already exist
do while not rsQuery.EOF
if rsQuery("FacultyID")=FacultyID then
set rsQuery=nothing
set dcnDB=nothing
Response.Redirect("create.asp")
end if
rsQuery.MoveNext
loop
' Opens the returned values from the SQL as a recordset, ready for iteration by ASP
'set rcSet = cnStr.Execute(sqlStr)

rsQuery.Addnew

rsQuery ("FacultyID")= Request.Form("FacultyID")
rsQuery ("Password")= Request.Form("Password")
rsQuery ("Department")= Request.Form("Department")
rsQuery ("FullName")= Request.Form("FullName")

rsQuery.Update


' validate variables against database
If (not rsQuery.BOF) and (not rsQuery.EOF) then

Response.cookies("FacultyID") = FacultyID
Response.cookies("FullName") = FullName


Response.write("<font size='5'>WELCOME</font> ")
response.write("&nbsp;")
Response.write("<font size='5'>")
response.write rsQuery.fields("FullName") & "&nbsp;"
response.write("<br/>")

response.write("FacultyID")
response.write("&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;")
response.write rsQuery.fields("FacultyID") & "<br/>"

response.write("Department")

response.write("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;")
response.write rsQuery.fields("Department") & "<br/>"

else
response.write "Incorrect FacultyID and/or Department and/or FullName"
end if

rsQuery .close
dcnDB.close
%>

In the code above I have got the follwing error

Microsoft JET Database Engine (0x80040E09)
Cannot update. Database or object is read-only.
/szone/welcome.asp, line 236





Similar Threads
Thread Thread Starter Forum Replies Last Post
Error while running javascript code in ASP.NET Pag fozia_izhar ASP.NET 1.0 and 1.1 Professional 2 December 20th, 2006 03:39 AM
error in snapshot generating code (asp) vinodkalpaka Classic ASP Components 2 July 20th, 2004 01:14 AM
error in snapshot generating code (asp) vinodkalpaka Pro VB 6 0 July 19th, 2004 01:19 AM
The Code of book ASP.NET Website Programming Error jackahu BOOK: ASP.NET Website Programming Problem-Design-Solution 0 June 16th, 2004 11:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.