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

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"
  7. 'conn_add.BeginTrans
  9. if ucase(TypeName(conn_add)) = "CONNECTION" then
  10. response.Write("CONNECTION MADE!")
  11. end if
  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
  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
  32. Set sthRecordset = Server.CreateObject("ADODB.Recordset")
  33. on error resume next
  35. sthRecordset.open "JobList",conn_add,2,3
  36. '2,3    adOpenDynamic=2/adOpenKeyset = 1, adLockOptimistic=3
  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()
  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. %>
Jul 19 '05 #1
1 2562
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
Jul 19 '05 #2

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

Similar topics

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...
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: ...
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...
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...
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...
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() ...
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...
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...
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...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.