Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2003, 12:30 PM
Registered User
 
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to danhur
Default Win2003 and ASP adovbs.inc

I have a database that I have been using for 2 years that has worked perfectly using two include files in the beginning of my ASP pages.


My ISP Host has updated his servers to Win2003 and now the insert new into the database for the registration section no longer inserts new data.

THe logic works, ie, if a new user puts in a user name that exists in the database on the server I get the appropriate error message.

code snippit:

DateMember = Now
duplicate=false

'Create our recordset object
Set objRS = Server.CreateObject("ADODB.Recordset")

'Open our recordset and our connection
objRS.Open "NewMems", objConn , 2, 2 ' NewMems is table in Access DB objConn set up in include file.

'Run a test to make sure no duplicate username already exists
'This test works
Do While Not (objRS.EOF OR duplicate) If (StrComp(objRS("username"), username, vbTextCompare) = 0) Then
'If a duplicate is found, we redirect back to the application.asp page with the correct error message
response.redirect "membership_application.asp?error=2"
End If
'Move to the next record and test it for a duplicate
objRS.MoveNext
'Continue to loop through the recordset for duplicates
Loop

'Assuming no duplicates were found, now we add a new record by calling the AddNew method
objRS.AddNew
' Somewhere in here it errors cause data never enters as new record.
'Now we insert the values of our variables into the appropriate fields
objRS.Fields("username") = username
objRS.Fields("FirstName") = firstname
objRS.Fields("LastName") = lastname
objRS.Fields("Email") = email
objRS.Fields("MembershipType") = membershiptype
objRS.Fields("Browser") = Browser
objRS.Fields("WhereFrom") = WhereFrom
objRS.Fields("DateMember") = DateMember
objRS.Fields("ExpirationDate") = frmExpireDates

'Finally, we call the update method to finish creating this record. Without calling the
'update method, it will not add the record so don't forget it.

objRS.Update
If err.number>0 then
   response.write "VBScript Errors Occured:" & "<P>"
    response.write "Error Number=" & err.number & "<P>"
    response.write "Error Descr.=" & err.description & "<P>"
    response.write "Help Context=" & err.helpcontext & "<P>"
    response.write "Help Path=" & err.helppath & "<P>"
    response.write "Native Error=" & err.nativeerror & "<P>"
    response.write "Source=" & err.source & "<P>"
    response.write "SQLState=" & err.sqlstate & "<P>"
end if
bookmark = objRS.absolutePosition ' First, store the location of you cursor
objRS.Requery ' Next, update your recordset with the data from the database
objRS.movelast
'after the requery, the absolutePosition is the first record of the recordset
'objRS.absolutePosition = bookmark Finally, change your cursor back
lUserID = objRS("memID")
if lUserID >1 then
    Session("sesmemID") = lUserID
end if


'Now we clean things up by closing our connection and recordset and setting both equal to nothing
objRS.Close
Set objRS = nothing
objConn.Close
Set objConn = nothing
' REDIRECT USER TO PAGE REQUESTED
''''''''''''''''''''''''''''''''''
Response.Redirect "school_information.asp" 'works, inotherwords redirects to correct page
%>



 
Old December 16th, 2003, 09:25 PM
Registered User
 
Join Date: Dec 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to danhur
Default

Problem Solved, Called Host and had him verify the DSN and path and permissions and everything mysteriously started working again.
Thanks all.






Similar Threads
Thread Thread Starter Forum Replies Last Post
WroxUnited - XP vs Win2003, IIS vs. Cassini etc holf BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 March 7th, 2006 10:18 AM
Crystal Reports 10 issues in Win2003 kewudemao Crystal Reports 2 February 20th, 2005 11:32 PM
file upload localhost iis/win2003 anshul Pro PHP 1 January 9th, 2005 03:12 PM
Setting up JMAIL component on Win2003 server borami Classic ASP Components 0 March 17th, 2004 08:37 AM
troubles to migrate web site to win2003 renee_santoscoi Classic ASP Components 0 September 30th, 2003 12:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.