473,839 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent! : Adding record to database!

1 New Member
--------------------------------------------------------------------------------

here is the code to the asp page that adds data to the access database!

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body>
  3.  
  4. <%
  5. Dim recordsaffected
  6.  
  7. set conn=Server.CreateObject("ADODB.Connection")
  8. conn.Provider="Microsoft.Jet.OLEDB.4.0"
  9. conn.Open "C:\Inetpub\wwwroot\final\database.mdb"
  10.  
  11. set recordsaffected=Server.CreateObject("ADODB.Recordset")
  12.  
  13. location=Request.Form("location")
  14. module=Request.Form("module")
  15. submodule=Request.Form("submodule")
  16. problemday=Request.Form("problemday")
  17. problemmonth=Request.Form("problemmonth")
  18. problemyear=Request.Form("problemyear")
  19. name=Request.Form("name")
  20. problemdescription=Request.Form("problemdescription")
  21.  
  22. on error resume next
  23. sql=" SELECT * FROM probdatabase"
  24.  
  25.  
  26. conn.Execute sql,recordsaffected
  27. recordsaffected.AddNew
  28. recordsaffected.fields("location")=location
  29. recordsaffected.fields("module")=module
  30. recordsaffected.fields("submodule")=submodule
  31. recordsaffected.fields("problemday")=problemday
  32. recordsaffected.fields("problemmonth")=problemmonth
  33. recordsaffected.fields("problemyear")=problemyear
  34. recordsaffected.fields("name")=name
  35. recordsaffected.fields("problemdescription")=problemdescription
  36. recordsaffected.update
  37.  
  38.  
  39.  
  40. if err<>0 then
  41. Response.Write(Err.Description)
  42. else 
  43. Response.Write("Record Added")
  44. end if
  45. conn.close
  46. recordsaffected.close
  47. Set recordsaffected = Nothing
  48. %>
  49.  
  50. </body>
  51. </html>
the problem i am facing is that it displays "OBJECT REQUIRED" after submiting the form... if I comment out the following
Expand|Select|Wrap|Line Numbers
  1. 'recordsaffected.AddNew
  2. 'recordsaffected.fields("location")=location
  3. 'recordsaffected.fields("module")=module
  4. 'recordsaffected.fields("submodule")=submodule
  5. 'recordsaffected.fields("problemday")=problemday
  6. 'recordsaffected.fields("problemmonth")=problemmonth
  7. 'recordsaffected.fields("problemyear")=problemyear
  8. 'recordsaffected.fields("name")=name
  9. 'recordsaffected.fields("problemdescription")=problemdescription
  10. 'recordsaffected.update
it displays record added... but nothing happens.. even if a single line from the above is left uncommented it displays "OBJECT REQUIRED'

PLZ HELP!!! gotta complete this task in 2 days...
Jul 5 '07 #1
1 1241
jhardman
3,406 Recognized Expert Specialist
try replacing the conn.execute line with
Expand|Select|Wrap|Line Numbers
  1. recordsaffected.open sql, conn
This is how I write it, does the same thing, and I don't get that error.

Let me know if this helps.

Jared
Jul 5 '07 #2

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

Similar topics

3
2453
by: Rob | last post by:
I have a form - when you click the submit button, it appends a variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable) It also opens a new page. Now, that some_dynamic_variable is actually the name of a form element on the parent window. On the new page, I have this javascript: ---- var var2 = location.search.substring(9); document.write(var2)
28
3078
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
16
2979
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In: http://www.mywebsite.org/WebResource.axd?d=5WvLfhnJp5Lc8WhQSD4gdA2&t=632614619884218750 -------------------------------------------------------------------------------- System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed. at...
3
6485
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from the socket is missing the last character (line feed). When the same text is sent without the urgent flag set, all of the characters are read. I'm reading the data using the blocking read call of the network stream class. The .NET...
7
5998
by: Cirene | last post by:
I used to use the Web Deployment Project with my VS2005 projects. Now I've fully upgraded to VS2008. Do I have to download a new version of the Web Deployment Project? If so where can I find it? If not, how do I have to change my deployment strategy? Thanks!
0
9855
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9697
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
10586
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
10648
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
10293
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...
1
7828
isladogs
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...
0
5866
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3134
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.