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(" ")
Response.write("<font size='5'>")
response.write rsQuery.fields("FullName") & " "
response.write("<br/>")
response.write("FacultyID")
response.write(" : ")
response.write rsQuery.fields("FacultyID") & "<br/>"
response.write("Department")
response.write(" &nbs p; : ")
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
|