i have these asp files to edit a record in my sql server..but it can't be done.
the error is
Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/testing/update22.asp, line 18
Can anyone help me??im stuck..thanks in advance
here's the code for update.asp
<html>
<body>
<script>
function editAll(url)
{
newwindow=window.open(url,'name');
if(window.focus){newwindow.focus()}
<html>
<body>
<h2>Update Record</h2>
<%
Dim connection
Dim rsSel
Dim sqlSel
set Connection = Server.CreateObject("ADODB.Connection")
qid=Request("qid")
sqlSel="SELECT * FROM rct_HighestQualification WHERE QualificationID= ' " & qid & "' "
Set rsSel = Server.CreateObject("ADODB.recordset")
rsSel.CursorLocation =3
rsSel.LockType =3
rsSel.Open sqlSel,connection
connection.Open "DSN=DSNName;UID=xxxx;PWD=xxxx;Database=xxxx"
if not rsSel.EOF then
id=rsSel("id")
name=rsSel("name")
%>
<form method="post" action="update22.asp" id=form1 name=form1>
<input type=text name="id" value="<%=id%>">
<input type=text name="name" value="<%=name%>">
<input type="submit" value="Update record" id=submit1 name=submit1>
</form>
</body>
</html>
<%end if
rsSel.Close()
set rsSel=nothing
%>
rsAll.Open sql,connection
%>
<h2>List Database</h2>
<%
if not rsAll.EOF then
do while not rsAll.EOF
id=rsAll("QualificationID")
name=rsAll("LevelOfQualification")
allurl="update22.asp? qid=" & id
%>
<table>
<tr>
<td class="items"><%=id%></td>
<td class="items"><%=name%></td>
<td colspan=2 class="items"><input type="button" value="edit" onclick="editAll('<%=allurl%>');"></td>
</tr>
</table>
<%
rsAll.MoveNext()
loop
else
end if
rsAll.Close()
set rsAll=nothing
%>
</body>
</html>
and here's the code for update22.asp
<html>
<body>
<h2>Update Record</h2>
<%
Dim connection
Dim rsSel
Dim sqlSel
set Connection = Server.CreateObject("ADODB.Connection")
qid=Request("qid")
sqlSel="SELECT * FROM rct_HighestQualification WHERE QualificationID= ' " & qid & "' "
Set rsSel = Server.CreateObject("ADODB.recordset")
rsSel.CursorLocation =3
rsSel.LockType =3
rsSel.Open sqlSel,connection
connection.Open "DSN=DSNName;UID=xxxx;PWD=xxxx;Database=xxxx"
if not rsSel.EOF then
id=rsSel("id")
name=rsSel("name")
%>
<form method="post" action="update22.asp" id=form1 name=form1>
<input type=text name="id" value="<%=id%>">
<input type=text name="name" value="<%=name%>">
<input type="submit" value="Update record" id=submit1 name=submit1>
</form>
</body>
</html>
<%end if
rsSel.Close()
set rsSel=nothing
%>