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
%>
2 2978
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: - connection.Open "DSN=DSNName;UID=xxxx;PWD=xxxx;Database=xxxx"
So it's just after the line: -
-
set Connection = Server.CreateObject("ADODB.Connection")
-
Hope this helps,
Dr B
thanks~~
yup..forgot to open it..
Sign in to post your reply or Sign up for a free account.
Similar topics |
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 invalid
connection.
/forms/maintreqresults1.asp, line 26.
I'm sure I'm missing something simple, but I am at a loss with this. The
code is below, the URL string appears to be valid:
|
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 see a particular link
that nobody else would. You'd find their name by getting their network
logon. This worked fine on all my pages, but for some reason, on one page,
it gives me an error. First, the error:
Error Type:
ADODB.Recordset...
|
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 (document.getElementById"].value=='1') {
confirm('Are you sure you want to delete this file?');
}
}
......
|
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 would amount to clicking Edit, Select All, CTRL-C
in Internet Explorer to capture some basic time 'n date
text from the military site and parse it.
|
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 problem editing, adding or
deleting rows.
But in webforms the smarttags don't offer the options.
Can anybody help?
| |
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 = Request("uuid")
|
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 (tables, queies, forms,
etc) from the database raises the same error. Trying to link to the tables
in the database raises the same error. I am guessing there is an autoexec
macro or code in the open event of the opening form that contains the error....
|
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 I have Categories and various Products in each Category. I'm trying to build a page to EDIT/UPDATE each product.I want to be able to change the Category that a product belongs to, but all I get in the drop-down menu is the one specific Category.
...
|
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 (ContactGateway.cfc)
- index.cfm - Deals with the business logic
- display/form.cfm - Produces the form for both add and edit behaviour
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |