473,756 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Addnew Method, ASP, MS-Access returns 500 error

I have been fighting with this script for several days and I'm finally
at the end of my rope. Here's the scenario:

-I have to add an entry into 1 table, called "calendar"
-I must retrieve the newly created autonumber field from this record
-Use the new ID number and insert it into a second table called
"cal_detail s"

--------------Begin Code--------------------
connString = "dsn=atpm"
set conn = Server.CreateOb ject("ADODB.con nection")
conn.connection TimeOut = 20
conn.open connString,"use rName","passwor d"

set rs = Server.CreateOb ject("ADODB.rec ordset")
rs.ActiveConnec tion = conn
rs.CursorLocati on = adUseServer
rs.CursorType = adOpenKeyset
rs.LockType = adLockOptimisti c
rs.Source = "calendar"
rs.Open

rs.addNew
rs("calID") = Request("calend arID")
rs("subject") = Request("eventS ubject")
rs.Update

eventId = rs("event_id")

If conn.Errors.Cou nt > 0 Then
For Each Err In conn.Errors
Response.Write( "Error " & Err.SQLState & ": " & _
Err.Description & " | " & Err.NativeError )
Next
conn.Errors.Cle ar
rs.cancelUpdate
End If
rs.close
set rs = nothing

'More code after this to add subsequent data to the cal_details table
---------End Code------------

Anyway, When I strip the code down and comment out the "rs.AddNew"
portion, there aren't any error. The moment I enable the code, I get a
500 server error (of course, it won't display the reason for the
error..I gotta work on better error handling).

Why doesn't the addNew method work? When I do a check on the recordset:

boolTest = rs.Supports(adA ddNew)

It returns "true"

Is there a setting i'm missing, can someone tell me? I have tried
several of the samples/tutorials on 4guysfromrolla. com, aspfree.com and
msdn.microsoft. com and none of them seem to work. The moment I enable
that "addNew" method, the server craps out on me with the 500 error.

On a side note, I was successfully able to run the code on a MySQL
database without a hitch.

Please help?

TIA,

--
Jon Trelfa
There 10 kinds of people in this world...
Those who understand binary and those who don't

Nov 12 '05 #1
1 5686
Jon Trelfa wrote:
I have been fighting with this script for several days and I'm finally
at the end of my rope. Here's the scenario:

-I have to add an entry into 1 table, called "calendar"
-I must retrieve the newly created autonumber field from this record
-Use the new ID number and insert it into a second table called
"cal_detail s"

<snip code>

Anyway, When I strip the code down and comment out the "rs.AddNew"
portion, there aren't any error. The moment I enable the code, I get
a 500 server error (of course, it won't display the reason for the
error..I gotta work on better error handling).

Why doesn't the addNew method work? When I do a check on the
recordset:

boolTest = rs.Supports(adA ddNew)

It returns "true"

Is there a setting i'm missing, can someone tell me? I have tried
several of the samples/tutorials on 4guysfromrolla. com, aspfree.com
and msdn.microsoft. com and none of them seem to work. The moment I
enable that "addNew" method, the server craps out on me with the 500
error.

On a side note, I was successfully able to run the code on a MySQL
database without a hitch.

Please help?

TIA,


John,

I don't have an answer for your problem, but a few suggestions:

- if you're testing in IE, go to Tools-->Internet Options-->Advanced, and
uncheck the Show Friendly HTTP Error Messges box. That will often get you
much more specific error information.

- check out http://www.aspfaq.com/ . They have some very helpful ASP/Access
info. The article:

http://www.aspfaq.com/show.asp?id=2174

covers what you're trying to do.

--

Peter Palmieri
Nov 12 '05 #2

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

Similar topics

2
10641
by: William Ortenberg | last post by:
I'm creating a new row in a table with via the AddNew method, where the table ID is an Autonumber field. I want to capture the value of the ID after I create the row. There are no other unique indices in the table. Can I do this? Thanks in advance.
1
3336
by: Ryan | last post by:
Hello, I have a quick question (I hope). I have a form with a combo box and a multi-selection list box. The list box is based on a query. Users can select values from the cmbobox to add to the list box (items they wish inserted into the table), or they can select items in the list box to delete (from the table). Once they have finished making any changes, they are to click a SAVE button to actually commit the changes to the database....
2
15576
by: Harold | last post by:
Sat I have a customers table with the fields CustomerID and Customer and I use the recordset.addnew method to add a new record to the table. What is the best way to get the CustomerID of the new record after recordset.update is executed? Recordset!CustomerID doesn't work because the recordset bookmark is on the first record. Moving to the last record doesn't work if the recordset is based on a query and the recordset is sorted. Thanks! ...
2
1366
by: guy | last post by:
if i use Generics.AddNew how do I pass an object to the items constructor? I have a set of class all inheriting from a base class, all requiring one parameter on their constructor - the data passed to it will be the same independent of the class type so how do i pass it to AddNew?
8
2351
by: MLH | last post by:
Here's a snippet from A97 HELP on AddNew... The record that was current before you used AddNew remains current. If you want to make the new record current, you can set the Bookmark property to the bookmark identified by the LastModified property setting. My own experience is indicating that the newly added record becomes current during the AddNew processes and REMAINS current after .Update method runs. This seems true even though the...
1
2084
by: Mwob | last post by:
Hi, We have been using ADO and the AddNew method for a long time as a means to add records to the database. It has always worked fine - no problem. But - we recently started using INSERT triggers that simply call a few stored procs (they're actually SSNS stored procs that send new event info to notification services). Anyway, these triggers do not seem to fire at all! If I execute an insert command manually from Query
0
3850
by: polocar | last post by:
Hi, I have noticed a strange behaviour of CurrencyManager objects in C# (I use Visual Studio 2005 Professional Edition). Suppose that you have a SQL Server database with 2 tables called "Cities" and "Persons", and that: "Cities" has 2 fields called "IDCity" and "NameCity" "Persons" has 3 fields called "IDPerson", "NamePerson" and "IDCityAddress" with "IDCity" and "IDCityAddress" fields relationed with the classical father-child relation...
2
12499
by: Thammarat charoenchai. | last post by:
After I use BindingSource.AddNew Method. (in my code is OrderBindingSource.AddNew). How can I set field value. like Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
10
8646
by: fniles | last post by:
In VB6 to add a new record in a recorset, you can use the Addnew method, then set each column's value, then call the Update method. How can I do this in VB.NET ? Thank you. VB6: Private m_rs As new ADODB.Recordset m_rs.Open "SELECT * FROM myTable", adoCon, adOpenKeyset, adLockOptimistic with m_rs
4
3698
by: salzan | last post by:
Hello, I'm trying to insert a new record in my recordset using AddNew method. I can't figure out how to declare values for the controls in my recordset. Can someone give me an example. Thank you in advance for your help. Salzan
0
9275
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,...
0
9872
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9843
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,...
0
9713
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8713
agi2029
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...
0
5142
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...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2666
bsmnconsultancy
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...

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.