Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Form info to DB problems!


Message #1 by "John Kinane" <john@k...> on Mon, 29 Oct 2001 14:06:19 -0500
I still haven't figured out this problem I was having last week and I am SO

frustrated.  Maybe if I break the problem down it might be easier to solve.



OK, this might be repetitive but here's a summary of what I need to do.



I have 3 tables; Person, Company, and Project.  I could make just one as an

easier way out but that will just cause more problems down the line and it

also creates a messy DB.



This is a service quote page.  I want to allow currently registered users

(that will already be in the Person table) and new users the ability to fill

out a form that will both update and add new information to these tables.

Current users that are logged in would find fields that contain registration

infomation they've already submitted filled in already.  This gives then the

opportunity to make changes to those fields if they need to ( e.g.

<%=Session("FirstName").  The other fields that are native to the Project

table would be, necessarily, empty since this is a request for a NEW

project.  The company table is optional since not every person will

represent a company.



Currently, I'm getting this error...



ADODB.Recordset error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested

operation requires a current record.

/kinane/hs~KinaneClientAdd.asp, line 12



There are no records because the info is being submitted as new information.

Would I be better off using a Command object?  How do you create a Recordset

when the info doesn't exist yet?



I'm in over my head as far as the algorithm goes so I need help.  I know the

key will come from my SQL statement but it may also come from how I'm

updating the DB.



Thanks!!!!!!!!!



the code...





<%@ LANGUAGE=VBSCRIPT %>

<%Option Explicit%>

<!--#include file = "KinaneConnection.asp" --> "I'm using Access here

<%

  Dim rsClients, clientSQL

  Set rsClients = Server.CreateObject("ADODB.Recordset")

clientSQL = "SELECT Project.*, Company.*, Person.* FROM (Person INNER JOIN

Project ON Person.PersonID =Project.projectContact) INNER JOIN Company ON

Person.PersonID =Company.companyContact WHERE Person.PersonID = " &

Session("PersonID") & ";"

  rsClients.Open clientSQL, objConn, adOpenDynamic, adLockOptimistic







  rsClients("FirstName") = Request.Form("FirstName")

  rsClients("LastName") = Request.Form("LastName")

  rsClients("Email") = Request.Form("Email")

  rsClients("StreetAddress1") = Request.Form("StreetAddress1")

  rsClients("StreetAddress2") = Request.Form("StreetAddress2")

  rsClients("City") = Request.Form("City")

  rsClients("State") = Request.Form("State")

  rsClients("Zip") = Request.Form("Zip")

  rsClients("areaCode") = Request.Form("areaCode")

  rsClients("phone") = Request.Form("phone")

  rsClients("areacodeFax") = Request.Form("areaCodeFax")

  rsClients("phoneFax") = Request.Form("phoneFax")

  rsClients("contactPref") = Request.Form("contactPref")

  rsClients("company") = Request.Form("company")

  rsClients("BizStreetAddress1") = Request.Form("BizStreetAddress1")

  rsClients("BizStreetAddress2") = Request.Form("BizStreetAddress2")

  rsClients("BizCity") = Request.Form("BizCity")

  rsClients("BizState") = Request.Form("BizState")

  rsClients("BizZip") = Request.Form("BizZip")

  rsClients("BizAreaCode") = Request.Form("BizAreaCode")

  rsClients("BizPhone") = Request.Form("BizPhone")

  rsClients("BizAreaCodeFax") = Request.Form("BizAreaCodeFax")

  rsClients("BizPhoneFax") = Request.Form("BizPhoneFax")

  rsClients("BizDescription") = Request.Form("BizDescription")

  rsClients("BizDatabase") = Request.Form("BizDatabase")

  rsClients("BizDatabaseType") = Request.Form("BizDatabaseType")

  rsClients("projTitle") = Request.Form("projTitle")

  rsClients("projType") = Request.Form("projType")

  rsClients("haveDomain") = Request.Form("haveDomain")

  rsClients("haveSite") = Request.Form("haveSite")

  rsClients("currentURL") = Request.Form("currentURL")

  rsClients("projDescription") = Request.Form("projDescription")

  rsClients("audienceWhere") = Request.Form("audienceWhere")

  rsClients("favSiteURL1") = Request.Form("favSiteURL1")

  rsClients("favSiteDescription1") = Request.Form("favSiteDescription1")

  rsClients("favSiteURL2") = Request.Form("favSiteURL2")

  rsClients("favSiteDescription2") = Request.Form("favSiteDescription2")

  rsClients("favSiteURL3") = Request.Form("favSiteURL3")

  rsClients("favSiteDescription3") = Request.Form("favSiteDescription3")

  rsClients("projComments") = Request.Form("projComments")

  rsClients("Client") = True

  rsClients("LastLogin") = Now

  rsClients.Update



  Dim strName, strValue                                   ' create session

variables

  For each strField in rsClients.Fields

    strName = strField.Name

    strValue = strField.value

    Session(strName) = strValue

  Next

  Session("blnValidUser") = True            ' declare that current user is

validated



  rsClients.Close

  Set rsClients = Nothing



  Response.Cookies("KinaneNet")("FirstName") = Request.Form("FirstName")

  Response.Cookies("KinaneNet")("NewsPref") = Request.Form("NewsPref")

  Response.Cookies("KinaneNet").Expires = Date + 365



  Response.Redirect "confirmed.asp"

%>









Message #2 by "Ken Schaefer" <ken@a...> on Tue, 30 Oct 2001 13:28:04 +1100
If you really want to use a recordset, then:



a) you need one recordset which holds existing data (eg the Person's

details)

b) another recordset which you're going to call the .AddNew method of to add

a new record. This recordset contains the fields from the Projects table.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----

From: "John Kinane" <john@k...>

To: "Access ASP" <access_asp@p...>

Sent: Tuesday, October 30, 2001 6:06 AM

Subject: [access_asp] Form info to DB problems!





: I still haven't figured out this problem I was having last week and I am

SO

: frustrated.  Maybe if I break the problem down it might be easier to

solve.

:

: OK, this might be repetitive but here's a summary of what I need to do.

:

: I have 3 tables; Person, Company, and Project.  I could make just one as

an

: easier way out but that will just cause more problems down the line and it

: also creates a messy DB.

:

: This is a service quote page.  I want to allow currently registered users

: (that will already be in the Person table) and new users the ability to

fill

: out a form that will both update and add new information to these tables.

: Current users that are logged in would find fields that contain

registration

: infomation they've already submitted filled in already.  This gives then

the

: opportunity to make changes to those fields if they need to ( e.g.

: <%=Session("FirstName").  The other fields that are native to the Project

: table would be, necessarily, empty since this is a request for a NEW

: project.  The company table is optional since not every person will

: represent a company.

:

: Currently, I'm getting this error...

:

: ADODB.Recordset error '800a0bcd'

: Either BOF or EOF is True, or the current record has been deleted.

Requested

: operation requires a current record.

: /kinane/hs~KinaneClientAdd.asp, line 12

:

: There are no records because the info is being submitted as new

information.

: Would I be better off using a Command object?  How do you create a

Recordset

: when the info doesn't exist yet?

:

: I'm in over my head as far as the algorithm goes so I need help.  I know

the

: key will come from my SQL statement but it may also come from how I'm

: updating the DB.

:

: Thanks!!!!!!!!!

:

: the code...

:

:

: <%@ LANGUAGE=VBSCRIPT %>

: <%Option Explicit%>

: <!--#include file = "KinaneConnection.asp" --> "I'm using Access here

: <%

:   Dim rsClients, clientSQL

:   Set rsClients = Server.CreateObject("ADODB.Recordset")

: clientSQL = "SELECT Project.*, Company.*, Person.* FROM (Person INNER JOIN

: Project ON Person.PersonID =Project.projectContact) INNER JOIN Company ON

: Person.PersonID =Company.companyContact WHERE Person.PersonID = " &

: Session("PersonID") & ";"

:   rsClients.Open clientSQL, objConn, adOpenDynamic, adLockOptimistic






  Return to Index