powerger
asked on
html connection
I am getting this error when trying to connect to database called student.mbd
Students Details
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xa04 Thread 0x7ec DBC 0x98ae244 Jet'.
/powerger/db/Students.asp, line 12
this is the html code for it
<html>
<head>
<title>Ger Power</title>
</head>
<body>
<font face="Arial" size="4" color="#000080">
<p>Students Details</p>
<%
Set oConn = Server.CreateObject("ADODB .Connectio n")
oConn.Open("DRIVER={Micros oft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db\student .mdb"))
'First we should check if trying to insert
'Only execute the INSERT statement if it has been requested
If Request("submit") = "Insert" Then
sSQL = "INSERT INTO Student VALUES ('" & Request("student name") & "', '" & Request("student no") & "', '" & Request("student email") & "'," & Request("exam marks") & ")"
Response.Write("SQL Query: " & sSQL & "<BR><BR>")
oConn.Execute(sSQL)
End If
'SELECT from the database
sSQL = "SELECT * FROM student"
set oRS = oConn.Execute(sSQL)
'Print headings
Response.Write("<table border=1 cellpadding=1 cellspacing=1 style='font-family:arial;f ont-size:1 0pt;'>")
Response.Write("<tr bgcolor=black style='color:blue;'><td>St udent Name</td>")
Response.Write("<td>Studen t No</td>")
Response.Write("<td>Studen t Email address</td>")
Response.Write("<td>Exam Marks</td></tr>")
'Print rows from record set
Do While NOT oRS.EOF
Response.Write("<tr><td>" & oRS("Student Name") & "</td>")
Response.Write("<td>" & oRS("Student No") & "</td>")
Response.Write("<td>" & oRS("Student Email") & "</td>")
Response.Write("<td align=right>" & oRS("Exam Marks") & "</td></tr>")
oRS.MoveNext
Loop
'End of table
Response.Write("</table><b r><br>")
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>
<p>Add a Student</p>
<form method="GET" action="Students.asp">
<p>Student Name:<input type="text" name="student name" size="20"></p>
<p>Student No: <input type="text" name="student no" size="20"></p>
<p>Student Email address: <input type="text" name="student email" size="20"></p>
<p>Exam Marks: <input type="text" name="exam marks" size="20"></p>
<p><input type="submit" value="Insert" name="submit"></p>
</form>
</font>
</body>
</html>
Students Details
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xa04 Thread 0x7ec DBC 0x98ae244 Jet'.
/powerger/db/Students.asp,
this is the html code for it
<html>
<head>
<title>Ger Power</title>
</head>
<body>
<font face="Arial" size="4" color="#000080">
<p>Students Details</p>
<%
Set oConn = Server.CreateObject("ADODB
oConn.Open("DRIVER={Micros
'First we should check if trying to insert
'Only execute the INSERT statement if it has been requested
If Request("submit") = "Insert" Then
sSQL = "INSERT INTO Student VALUES ('" & Request("student name") & "', '" & Request("student no") & "', '" & Request("student email") & "'," & Request("exam marks") & ")"
Response.Write("SQL Query: " & sSQL & "<BR><BR>")
oConn.Execute(sSQL)
End If
'SELECT from the database
sSQL = "SELECT * FROM student"
set oRS = oConn.Execute(sSQL)
'Print headings
Response.Write("<table border=1 cellpadding=1 cellspacing=1 style='font-family:arial;f
Response.Write("<tr bgcolor=black style='color:blue;'><td>St
Response.Write("<td>Studen
Response.Write("<td>Studen
Response.Write("<td>Exam Marks</td></tr>")
'Print rows from record set
Do While NOT oRS.EOF
Response.Write("<tr><td>" & oRS("Student Name") & "</td>")
Response.Write("<td>" & oRS("Student No") & "</td>")
Response.Write("<td>" & oRS("Student Email") & "</td>")
Response.Write("<td align=right>" & oRS("Exam Marks") & "</td></tr>")
oRS.MoveNext
Loop
'End of table
Response.Write("</table><b
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>
<p>Add a Student</p>
<form method="GET" action="Students.asp">
<p>Student Name:<input type="text" name="student name" size="20"></p>
<p>Student No: <input type="text" name="student no" size="20"></p>
<p>Student Email address: <input type="text" name="student email" size="20"></p>
<p>Exam Marks: <input type="text" name="exam marks" size="20"></p>
<p><input type="submit" value="Insert" name="submit"></p>
</form>
</font>
</body>
</html>
ASKER
I fixed the first error, now i am getting this error
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/powerger/Students.asp, line 19
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/powerger/Students.asp, line 19
Don't you need to tell the DB what fields the data goes into?
sSQL = "INSERT INTO Student VALUES ('" & Request("student name") & "', '" & Request("student no") & "', '" & Request("student email") & "'," & request("exam marks") & ")"
Becomes
sSQL = "INSERT INTO Student (name, ID, email, score) VALUES ('" & Request("student name") & "', '" & Request("student no") & "', '" & Request("student email") & "'," & request("exam marks") & ")"
sSQL = "INSERT INTO Student VALUES ('" & Request("student name") & "', '" & Request("student no") & "', '" & Request("student email") & "'," & request("exam marks") & ")"
Becomes
sSQL = "INSERT INTO Student (name, ID, email, score) VALUES ('" & Request("student name") & "', '" & Request("student no") & "', '" & Request("student email") & "'," & request("exam marks") & ")"
ASKER
I have changed around the code and done what you said but i am getting this error now
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/powerger/Students.asp, line 19
<html>
<head>
<title>Ger Power</title>
</head>
<body>
<font face="Arial" size="4" color="#000080">
<p>Students Details</p>
<%
Set oConn = Server.CreateObject("ADODB .Connectio n")
oConn.Open("DRIVER={Micros oft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db\student .mdb"))
'First we should check if trying to insert
'Only execute the INSERT statement if it has been requested
If Request("submit") = "Insert" Then
sSQL = "INSERT INTO student (Student Name,Student Id,Student Email,Exam Marks) VALUES ('" & Request("student name") & "', " & Request("student id") & ",'" & Request("student email") & "'," & Request("exam marks") & ")"
Response.Write("SQL Query: " & sSQL & "<BR><BR>")
oConn.Execute(sSQL)
End If
'SELECT from the database
sSQL = "SELECT * FROM student"
set oRS = oConn.Execute(sSQL)
'Print headings
Response.Write("<table border=1 cellpadding=1 cellspacing=1 style='font-family:arial;f ont-size:1 0pt;'>")
Response.Write("<tr bgcolor=black style='color:black;'><td>S tudent Name</td>")
Response.Write("<td>Studen t Id</td>")
Response.Write("<td>Studen t Email address</td>")
Response.Write("<td>Exam Marks</td></tr>")
'Print rows from record set
Do While NOT oRS.EOF
Response.Write("<tr><td>" & oRS("Student Name") & "</td>")
Response.Write("<td>" & oRS("Student Id") & "</td>")
Response.Write("<td>" & oRS("Student Email") & "</td>")
Response.Write("<td align=right>" & oRS("Exam Marks") & "</td></tr>")
oRS.MoveNext
Loop
'End of table
Response.Write("</table><b r><br>")
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>
<p>Add a Student</p>
<form method="GET" action="Students.asp">
<p>Student Name:<input type="text" name="student name" size="30"></p>
<p>Student No: <input type="text" name="student id" size="30"></p>
<p>Student Email address: <input type="text" name="student email" size="50"></p>
<p>Exam Marks: <input type="text" name="exam marks" size="20"></p>
<p><input type="submit" value="Insert" name="submit"></p>
</form>
</font>
</body>
</html>
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
/powerger/Students.asp, line 19
<html>
<head>
<title>Ger Power</title>
</head>
<body>
<font face="Arial" size="4" color="#000080">
<p>Students Details</p>
<%
Set oConn = Server.CreateObject("ADODB
oConn.Open("DRIVER={Micros
'First we should check if trying to insert
'Only execute the INSERT statement if it has been requested
If Request("submit") = "Insert" Then
sSQL = "INSERT INTO student (Student Name,Student Id,Student Email,Exam Marks) VALUES ('" & Request("student name") & "', " & Request("student id") & ",'" & Request("student email") & "'," & Request("exam marks") & ")"
Response.Write("SQL Query: " & sSQL & "<BR><BR>")
oConn.Execute(sSQL)
End If
'SELECT from the database
sSQL = "SELECT * FROM student"
set oRS = oConn.Execute(sSQL)
'Print headings
Response.Write("<table border=1 cellpadding=1 cellspacing=1 style='font-family:arial;f
Response.Write("<tr bgcolor=black style='color:black;'><td>S
Response.Write("<td>Studen
Response.Write("<td>Studen
Response.Write("<td>Exam Marks</td></tr>")
'Print rows from record set
Do While NOT oRS.EOF
Response.Write("<tr><td>" & oRS("Student Name") & "</td>")
Response.Write("<td>" & oRS("Student Id") & "</td>")
Response.Write("<td>" & oRS("Student Email") & "</td>")
Response.Write("<td align=right>" & oRS("Exam Marks") & "</td></tr>")
oRS.MoveNext
Loop
'End of table
Response.Write("</table><b
oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>
<p>Add a Student</p>
<form method="GET" action="Students.asp">
<p>Student Name:<input type="text" name="student name" size="30"></p>
<p>Student No: <input type="text" name="student id" size="30"></p>
<p>Student Email address: <input type="text" name="student email" size="50"></p>
<p>Exam Marks: <input type="text" name="exam marks" size="20"></p>
<p><input type="submit" value="Insert" name="submit"></p>
</form>
</font>
</body>
</html>
First: Are these the real names of the data fields in your table?
(Student Name,Student Id,Student Email,Exam Marks)
Second: Using whitespace characters in a field/column name is not recommended. It makes it hard to refer to them as variables. Try double-quoting the column names. I'm not 100% sure it will work but it's worth a try.
("Student Name","Student Id","Student Email","Exam Marks")
(Student Name,Student Id,Student Email,Exam Marks)
Second: Using whitespace characters in a field/column name is not recommended. It makes it hard to refer to them as variables. Try double-quoting the column names. I'm not 100% sure it will work but it's worth a try.
("Student Name","Student Id","Student Email","Exam Marks")
ASKER
I took out the spaces in the database, and renamed the code, getting no syntax errors, back to this error
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/powerger/Students.asp, line 19
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/powerger/Students.asp, line 19
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER