473,748 Members | 4,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having trouble adding Recordset into access database through ASP

Hi i am having trouble adding a recordset into the access database,
the code seems to be working fine it passs and parses through all
variables just fine without showing any errors and also when i access
the recordset it displays the results, what the real issue is that the
entry is not made into the database even though i use the Update
command and i have also tried the BeginTrans and CommitTrans nothign
seems to work and i am unable to figure out wats wrong with this
code.....here is the code below...plz help me out i would really
apreciate any help...thanks
Expand|Select|Wrap|Line Numbers
  1. <%
  2. ' Connect to database
  3. Set conn_add = Server.CreateObject("ADODB.Connection")
  4. 'conn_add.mode = 3    'readWrite mode
  5. conn_add.Open "DSN=semda; UserID=USERIDSTRING; pwd=PWDSTRING"
  6.  
  7. 'conn_add.BeginTrans
  8.  
  9. if ucase(TypeName(conn_add)) = "CONNECTION" then
  10. response.Write("CONNECTION MADE!")
  11. end if
  12.  
  13.  
  14. If Request.Form("DescShort") = "" Or Request.Form("DescLong") = ""
  15. Then
  16. ErrStr = "You didn't fill in all the required fields. Please go back
  17. and enter all required data."
  18. Else    'Insert into database
  19.  
  20. 'pulling out max_job
  21. Set maxJobID = Server.CreateObject("ADODB.Recordset")
  22. maxJobID.open "Select max(JobID) as max_job from JobList", conn_add
  23. Do while not maxJobID.eof
  24. max_job=maxJobID("max_job")
  25. maxJobID.MoveNext
  26. Loop
  27. response.Write("<br>MAX JOB ID IS: "& max_job &"<br>")
  28. max_job=max_job+1
  29. maxJobID.Close
  30. Set maxJobID= Nothing
  31.  
  32. Set sthRecordset = Server.CreateObject("ADODB.Recordset")
  33. on error resume next
  34.  
  35. sthRecordset.open "JobList",conn_add,2,3
  36. '2,3    adOpenDynamic=2/adOpenKeyset = 1, adLockOptimistic=3
  37.  
  38. 'check for errors
  39. on error resume next
  40. If conn_add.Errors.count > 0 Then
  41. Set objErr = Server.CreateObject("ADODB.Error")
  42. for each objErr in conn_add.Errors
  43. If objErr.Number <> 0 Then
  44. response.Write("Number: " & objErr.Number & "<p>")
  45. response.Write("Description: " & objErr.Description & "<p>")
  46. response.Write("Source: " & objErr.Source & "<p>")
  47. response.Write("SQLState: " & objErr.SQLState & "<p>")
  48. response.Write("NativeError: " & objErr.NativeError & "<p>")
  49. End If
  50. next
  51. Else
  52. sthRecordset.AddNew
  53. response.Write("NEW RECORD ADDED")
  54. sthRecordset.Fields("JobID") = max_job
  55. sthRecordset.Fields("DescShort") = Request.Form("DescShort")
  56. sthRecordset.Fields("DescLong") = Request.Form("DescLong")
  57. sthRecordset.Fields("TypeID") = Request.Form("TypeID")
  58. sthRecordset.Fields("PayLow") = Request.Form("PayLow")
  59. sthRecordset.Fields("PayHi") = Request.Form("PayHi")
  60. sthRecordset.Fields("ContactName") = Request.Form("ContactName")
  61. sthRecordset.Fields("Phone") = Request.Form("Phone")
  62. sthRecordset.Fields("Fax") = Request.Form("Fax")
  63. sthRecordset.Fields("Email") = Request.Form("Email")
  64. sthRecordset.Fields("Web") = Request.Form("Web")
  65. sthRecordset.Fields("Verified") = "No"
  66. If Request.Form("ExpireDate") = "" Then
  67. sthRecordset.Fields("ExpireDate") = Date()+30
  68. Else
  69. sthRecordset.Fields("ExpireDate") = Request.Form("ExpireDate")
  70. End if
  71. sthRecordset.Fields("EnterDate") = Now()
  72.  
  73. If sthRecordset.Fields("ExpireDate") = "" Then
  74. ErrStr = "There was a problem converting the expiration date you
  75. entered. " &_
  76. "Please go back and make sure you entered a date in the format
  77. specified."
  78. response.Write("<br>IN HERE<br>")
  79. sthRecordset.CancelUpdate
  80. 'conn_add.RollbackTrans
  81. Else
  82. sthRecordset.Update
  83. 'conn_add.CommitTrans
  84. JobID = sthRecordset.Fields("JobID")
  85. response.Write("<br>NEW RECORD ADDED TOTALY with job id: "& JobID)
  86. EXPdate = sthRecordset.Fields("ExpireDate")
  87. response.Write("<br>EXP DATE: "& EXPdate)
  88. End If
  89. sthRecordset.Close
  90. Set sthRecordset = Nothing
  91. End If
  92. End If
  93. %>
  94.  
Jul 19 '05 #1
1 2587
Anand wrote:
Hi i am having trouble adding a recordset into the access database,


Already answered over in .db

Please do not multipost Anand. This is definitely a database-related
question so .asp.db was the perfect group in which to post it. Posting it
here as well did not increase your chances of getting an answer (most of us
subscribe to both groups). On the contrary, if somebody had taken his time
to answer it here, only to find that it was already resolved in the other
group, that person may have been annoyed enough to ignore any future posts
from you, thereby decreasing your chances of getting help in the future.

There are times when you will not be sure which group is most appropriate
(again, this was not one of them), and you will want to post a question to
both groups. In that situation, you should use the cross-posting technique,
rather than posting the same message multiple times. To crosspost, put
a semicolon-delimited* list of the newsgroups to which you wish to post in
the To: header of your post and post it once. It, and any replies to it,
will appear in all the newsgroups in your list. So, if I reply in .asp.db,
my reply will also appear here in .asp.general.

* ... or whatever delimiter is recognized by your news client

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 #2

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

Similar topics

15
2805
by: Peroq | last post by:
Hi all I'm not sure ASP is the problem, but my SQL statement seems fine to me. This works fine : strSQL = "SELECT .* FROM _RechPat INNER JOIN NivPatri ON .cod_niv = NivPatri.cod_niv WHERE NivPatri.position=2" set rs = CreateRecordset(strSQL) This doesn't work :
7
781
by: Alex | last post by:
Hi all, I've found a module that I think will help me combine fields properly, but I'm unsure how to add or use it with Access 2000. Below is the module I'd like to add: http://www.mvps.org/access/modules/mdl0008.htm In Access, I goto Modules and create new. Leaving 'Option Compare Database' on top I paste the module code in and save - naming it fConcatFld. It saves fine, but when I use fConcatFld in my query, like below:
1
1598
by: Will | last post by:
Hi, I have a form which calculates a final cost (frmWorkCosts, data stored in tblWorkCosts) and once calculated adds this final cost (Which isn't saved in tblWorkCosts) into a different table (tblLabour) as a new record. Once it has done this I want it to save the Labour ID (Key Field/Autonumber in tblLabour) to the Labour ID field in the original calculation table tblWorkCosts, creating a link between the two tables. I have tried a...
9
2067
by: TD | last post by:
I am trying to add transactions to my code. The original code worked fine until I followed an example to setup transactions, now the code does strange things, but no error messages. Could someone please review my before and after code and tell me the proper way to add transactions to my code? Thanks, TD
59
7513
by: Rico | last post by:
Hello, I have an application that I'm converting to Access 2003 and SQL Server 2005 Express. The application uses extensive use of DAO and the SEEK method on indexes. I'm having an issue when the recordset opens a table. When I write Set rst = db.OpenRecordset("MyTable",dbOpenTable, dbReadOnly) I get an error. I believe it's invalid operation or invalid parameter, I'm
1
5148
by: MLH | last post by:
Am having trouble with the filter property setting below. Would like to filter the listing to car makes beginning with "D". I'm blowing it on the filter spec somehow??? Sub OpenRecordsetX() Dim MyDB As Database Dim rstTemp As Recordset Dim rstTemp2 As Recordset Set MyDB = CurrentDb()
1
2041
by: John Wright | last post by:
I am running a console application that connects to an Access database (8 million rows) and converts it to a text file and then cleans and compacts the database. When it runs I get the following error: The CLR has been unable to transition from COM context 0x1a2008 to COM context 0x1a2178 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long...
2
3790
by: ARC | last post by:
Just curious if anyone is having issues with Acc 2007 once the number of objects and complexity increases? I have a fairly large app, with many linked tables, 100's of forms, queries, reports, and lots of vba code. I'm nearly finished with re-doing my app in access 2007, and just imported an add-in program, which has added even more forms, queries and linked tables. Every so often now, after opening many different screens, I'll...
1
2019
damonreid
by: damonreid | last post by:
Access 2003 Microsoft Windows XP Pro Hey, I am currently pulling my hair out here. I have a Form for adding new projects to a database, the only problem is that when I close the form it doesn't insert that information into the table. This is a major problem as it is suppose to use the information to populate several other tables with key information and open another form based on some of that information (in this case project number). ...
0
9534
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, 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...
1
9316
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
9241
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
8239
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...
1
6793
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
6073
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();...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
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
2211
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.