473,395 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

can't edit to database error type 0x800A0E7D

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
%>
Mar 26 '08 #1
2 2962
DrBunchman
979 Expert 512MB
Hi colesslow,

You've got a little bug in your code; you're trying to open your record set object, using your database connection, before you've opened the database connection itself.

In Update22.asp simply move the line:
Expand|Select|Wrap|Line Numbers
  1. connection.Open "DSN=DSNName;UID=xxxx;PWD=xxxx;Database=xxxx"
So it's just after the line:
Expand|Select|Wrap|Line Numbers
  1.  
  2. set Connection = Server.CreateObject("ADODB.Connection")
  3.  
Hope this helps,

Dr B
Mar 26 '08 #2
thanks~~
yup..forgot to open it..
Mar 31 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tom Petersen | last post by:
I have been copying and pasting code and this has been working, but now I get this error: Error Type: ADODB.Recordset (0x800A0E7D) Operation is not allowed on an object referencing a closed or...
8
by: middletree | last post by:
I had some text links at the top of all my pages (in one include file), which worked just fine. But I was asked to make it so that people in a certain department, (this is an Intranet app) would...
13
by: LRW | last post by:
Having a problem getting a onSubmit function to work, to where it popsup a confirmation depending on which radiobutton is selected. Here's what I have: function checkdel() { if...
17
by: MLH | last post by:
After running the following code snippet... MyURL = "http://tycho.usno.navy.mil/what.html" msXML.Open "GET", MyURL, False msXML.send I would like to execute code to perform essentially what...
12
by: dennist685 | last post by:
Can't edit, delete or add row in an Access database in a website 2003 When I implement a walkthrough using Northwind I have no trouble doing this. Also, in a windowsforms project I have no...
3
by: nordwall | last post by:
Hi! I am starting out with ASP and have tried the following code, to no avail as I get a error: ADODB.Recordset.1 (0x800A0E7D) Invalid connection. /save.asp, line 12 <% uuid =...
12
by: Steve | last post by:
I have a database that raises an error when you try to open it and it doesn't open. Trying to open the database with the OpenDatabase method raises the same error. Trying to import any objects...
1
by: ollielaroo | last post by:
Hi guys, Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site. My problem is...
1
by: chromis | last post by:
Hi, I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following: - Bean (Contact.cfc) - Data Access object (ContactDAO.cfc) - Gateway...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.