473,387 Members | 1,541 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,387 software developers and data experts.

ASP and Access SQL Problem

I am attempting to insert data into an Access 2k database with the
following in an asp page:

strSQL="INSERT INTO EmpIncentive(Purple, " & _
"Red, Orange, Yellow, Green, Blue, Clndr) " & _
"VALUES('" & rEmployee & "', '" & rdffclt & "', '" & rrspnsetm & "', '"
& rcrrctd & "', '" & rcstmrsrvc & "', '" & rcmmnts & "', '" & rclndr &
"')"
Dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
objRS.Close
Set objRS=Nothing
objConn.Close
Set objConn=Nothing

When the user hits submit, the data from the form page is posted to a
"Success" page where the above SQL statement is executed. The data is
successfully inserted; however, the html/asp page that is the "Success"
page is supposed to summarize the data for the user gives me the
following error:

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/incentive/incentive.asp, line 52

I commented out the objRS.Close line and things work (the line with the
error above. Is this proper?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
3 1361
There is no details on objConn in the page. Where do you initialize the
variable/create a connection to the database?

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Micromanaged" <no*****@nospam.org> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
I am attempting to insert data into an Access 2k database with the
following in an asp page:

strSQL="INSERT INTO EmpIncentive(Purple, " & _
"Red, Orange, Yellow, Green, Blue, Clndr) " & _
"VALUES('" & rEmployee & "', '" & rdffclt & "', '" & rrspnsetm & "', '"
& rcrrctd & "', '" & rcstmrsrvc & "', '" & rcmmnts & "', '" & rclndr &
"')"
Dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
objRS.Close
Set objRS=Nothing
objConn.Close
Set objConn=Nothing

When the user hits submit, the data from the form page is posted to a
"Success" page where the above SQL statement is executed. The data is
successfully inserted; however, the html/asp page that is the "Success"
page is supposed to summarize the data for the user gives me the
following error:

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/incentive/incentive.asp, line 52

I commented out the objRS.Close line and things work (the line with the
error above. Is this proper?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2
Micromanaged wrote:
I am attempting to insert data into an Access 2k database with the
following in an asp page:

strSQL="INSERT INTO EmpIncentive(Purple, " & _
"Red, Orange, Yellow, Green, Blue, Clndr) " & _
"VALUES('" & rEmployee & "', '" & rdffclt & "', '" & rrspnsetm & "',
'" & rcrrctd & "', '" & rcstmrsrvc & "', '" & rcmmnts & "', '" &
rclndr & "')"
Dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
This is bad. Your query does not return records - why open a recordset???

objConn.Execute strSQL,,129
objRS.Close
Set objRS=Nothing
objConn.Close
Set objConn=Nothing

When the user hits submit, the data from the form page is posted to a
"Success" page where the above SQL statement is executed. The data is
successfully inserted; however, the html/asp page that is the
"Success" page is supposed to summarize the data for the user gives
me the following error:

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/incentive/incentive.asp, line 52

I commented out the objRS.Close line and things work (the line with
the error above. Is this proper?

You need to open a recordset using a query that returns records in order for
you to read data from it ...

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
Do this. I am assuming that objConn is opened before this code is hit.

strSQL = whatever ...
objConn.Execute strSQL

And do not use the recordset at all. There is no recordset for an INSERT
statement to return anyway.

S
"Micromanaged" <no*****@nospam.org> wrote in message
news:eG*************@tk2msftngp13.phx.gbl...
I am attempting to insert data into an Access 2k database with the
following in an asp page:

strSQL="INSERT INTO EmpIncentive(Purple, " & _
"Red, Orange, Yellow, Green, Blue, Clndr) " & _
"VALUES('" & rEmployee & "', '" & rdffclt & "', '" & rrspnsetm & "', '"
& rcrrctd & "', '" & rcstmrsrvc & "', '" & rcmmnts & "', '" & rclndr &
"')"
Dim objRS
Set objRS=Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn
objRS.Close
Set objRS=Nothing
objConn.Close
Set objConn=Nothing

When the user hits submit, the data from the form page is posted to a
"Success" page where the above SQL statement is executed. The data is
successfully inserted; however, the html/asp page that is the "Success"
page is supposed to summarize the data for the user gives me the
following error:

Error Type:
ADODB.Recordset (0x800A0E78)
Operation is not allowed when the object is closed.
/incentive/incentive.asp, line 52

I commented out the objRS.Close line and things work (the line with the
error above. Is this proper?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
13
by: Al the programmer | last post by:
I need to access the serial ports on my webserver from an asp.net page. I have no problem accessing the serial ports from a windows form application, but the code doesn't work in asp.net. I have...
17
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a...
5
by: B1ackwater | last post by:
We've fooled around with Access a bit, but only using the single-user store-bought version. It seems to be a good database - versatile and infinitely programmable - and can apparently be used as a...
34
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button...
21
by: Bigpond News | last post by:
Work at a large site - 1000+ PC's. Mixture of Win98 & WinXP. Majority of applications using Access 97. If I compile the Acc97 application on a Win98 PC, the .mde will run perfectly on both...
18
by: surfrat_ | last post by:
Hi, I am having the following problems in getting Microsoft Visual Studio 2005 Professional to link to an Access .mdb database. Please help me to sort this out. Problem 1: The Microsoft...
7
by: clintonG | last post by:
To all Microsoft partners and customers who have been unable to download recently or access ASP.NET documentation from the msdn2 website and for all of those customers who have been lied to and...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
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,...

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.