Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Having trouble adding Recordset into access database through ASP

Thread Tools

Having trouble adding Recordset into access database through ASP

Posts: n/a
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 is the code below...plz help me out i would really
apreciate any help...thanks
' Connect to database
Set conn_add = Server.CreateObject("ADODB.Connection")
'conn_add.mode = 3	'readWrite mode
conn_add.Open "DSN=semda; UserID=USERIDSTRING; pwd=PWDSTRING"


if ucase(TypeName(conn_add)) = "CONNECTION" then
response.Write("CONNECTION MADE!")
end if

If Request.Form("DescShort") = "" Or Request.Form("DescLong") = ""
ErrStr = "You didn't fill in all the required fields. Please go back
and enter all required data."
Else	'Insert into database

'pulling out max_job
Set maxJobID = Server.CreateObject("ADODB.Recordset") "Select max(JobID) as max_job from JobList", conn_add
Do while not maxJobID.eof
response.Write("<br>MAX JOB ID IS: "& max_job &"<br>")
Set maxJobID= Nothing

Set sthRecordset = Server.CreateObject("ADODB.Recordset")
on error resume next "JobList",conn_add,2,3
'2,3	adOpenDynamic=2/adOpenKeyset = 1, adLockOptimistic=3

'check for errors
on error resume next
If conn_add.Errors.count > 0 Then
Set objErr = Server.CreateObject("ADODB.Error")
for each objErr in conn_add.Errors
If objErr.Number <> 0 Then
response.Write("Number: " & objErr.Number & "<p>")
response.Write("Description: " & objErr.Description & "<p>")
response.Write("Source: " & objErr.Source & "<p>")
response.Write("SQLState: " & objErr.SQLState & "<p>")
response.Write("NativeError: " & objErr.NativeError & "<p>")
End If
response.Write("NEW RECORD ADDED")
sthRecordset.Fields("JobID") = max_job
sthRecordset.Fields("DescShort") = Request.Form("DescShort")
sthRecordset.Fields("DescLong") = Request.Form("DescLong")
sthRecordset.Fields("TypeID") = Request.Form("TypeID")
sthRecordset.Fields("PayLow") = Request.Form("PayLow")
sthRecordset.Fields("PayHi") = Request.Form("PayHi")
sthRecordset.Fields("ContactName") = Request.Form("ContactName")
sthRecordset.Fields("Phone") = Request.Form("Phone")
sthRecordset.Fields("Fax") = Request.Form("Fax")
sthRecordset.Fields("Email") = Request.Form("Email")
sthRecordset.Fields("Web") = Request.Form("Web")
sthRecordset.Fields("Verified") = "No"
If Request.Form("ExpireDate") = "" Then
sthRecordset.Fields("ExpireDate") = Date()+30
sthRecordset.Fields("ExpireDate") = Request.Form("ExpireDate")
End if
sthRecordset.Fields("EnterDate") = Now()

If sthRecordset.Fields("ExpireDate") = "" Then
ErrStr = "There was a problem converting the expiration date you
entered. " &_
"Please go back and make sure you entered a date in the format
response.Write("<br>IN HERE<br>")
JobID = sthRecordset.Fields("JobID")
response.Write("<br>NEW RECORD ADDED TOTALY with job id: "& JobID)
EXPdate = sthRecordset.Fields("ExpireDate")
response.Write("<br>EXP DATE: "& EXPdate)
End If
Set sthRecordset = Nothing
End If
End If
Reply With Quote
Bob Barrows
Posts: n/a
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

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase Computer Information 0 09-26-2012 09:40 AM
How can IIS access the database without having ASPNET account in the database Tony Johansson ASP .Net 7 12-23-2009 04:39 PM
RecordSet.Move or RecordSet.AbsolutePosition?? Hung Huynh ASP General 8 09-24-2003 11:07 AM
I need help. I am having trouble clearing a field in an Access database. Tim ASP General 4 08-05-2003 07:31 PM