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=windo w.open(url,'nam e');
if(window.focus ){newwindow.foc us()}
<html>
<body>
<h2>Update Record</h2>
<%
Dim connection
Dim rsSel
Dim sqlSel
set Connection = Server.CreateOb ject("ADODB.Con nection")
qid=Request("qi d")
sqlSel="SELECT * FROM rct_HighestQual ification WHERE QualificationID = ' " & qid & "' "
Set rsSel = Server.CreateOb ject("ADODB.rec ordset")
rsSel.CursorLoc ation =3
rsSel.LockType =3
rsSel.Open sqlSel,connecti on
connection.Open "DSN=DSNName;UI D=xxxx;PWD=xxxx ;Database=xxxx"
if not rsSel.EOF then
id=rsSel("id")
name=rsSel("nam e")
%>
<form method="post" action="update2 2.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("Quali ficationID")
name=rsAll("Lev elOfQualificati on")
allurl="update2 2.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="editAl l('<%=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.CreateOb ject("ADODB.Con nection")
qid=Request("qi d")
sqlSel="SELECT * FROM rct_HighestQual ification WHERE QualificationID = ' " & qid & "' "
Set rsSel = Server.CreateOb ject("ADODB.rec ordset")
rsSel.CursorLoc ation =3
rsSel.LockType =3
rsSel.Open sqlSel,connecti on
connection.Open "DSN=DSNName;UI D=xxxx;PWD=xxxx ;Database=xxxx"
if not rsSel.EOF then
id=rsSel("id")
name=rsSel("nam e")
%>
<form method="post" action="update2 2.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
%>
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=windo w.open(url,'nam e');
if(window.focus ){newwindow.foc us()}
<html>
<body>
<h2>Update Record</h2>
<%
Dim connection
Dim rsSel
Dim sqlSel
set Connection = Server.CreateOb ject("ADODB.Con nection")
qid=Request("qi d")
sqlSel="SELECT * FROM rct_HighestQual ification WHERE QualificationID = ' " & qid & "' "
Set rsSel = Server.CreateOb ject("ADODB.rec ordset")
rsSel.CursorLoc ation =3
rsSel.LockType =3
rsSel.Open sqlSel,connecti on
connection.Open "DSN=DSNName;UI D=xxxx;PWD=xxxx ;Database=xxxx"
if not rsSel.EOF then
id=rsSel("id")
name=rsSel("nam e")
%>
<form method="post" action="update2 2.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("Quali ficationID")
name=rsAll("Lev elOfQualificati on")
allurl="update2 2.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="editAl l('<%=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.CreateOb ject("ADODB.Con nection")
qid=Request("qi d")
sqlSel="SELECT * FROM rct_HighestQual ification WHERE QualificationID = ' " & qid & "' "
Set rsSel = Server.CreateOb ject("ADODB.rec ordset")
rsSel.CursorLoc ation =3
rsSel.LockType =3
rsSel.Open sqlSel,connecti on
connection.Open "DSN=DSNName;UI D=xxxx;PWD=xxxx ;Database=xxxx"
if not rsSel.EOF then
id=rsSel("id")
name=rsSel("nam e")
%>
<form method="post" action="update2 2.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
%>
Comment