|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
web survey need help
<i><b>Originally posted by : hammax (hammax_2000@yahoo.com)</b></i><br />Background:<br /><br />I am trying to create a web survey for one of my professors at the college I attend. The survey is 7 separate pages with the data going into one database file. I am only using text boxes and radio buttons. The database is composed of one table (using Access 97) with all the variables in that one table. The problem I am having is keeping track of each particular person as they go through the survey because they will be more than one person at a time probably no more than 10. I have also been told I am can not use cookies. On the first page of the survey they put in their name, email, etc. Then they assigned an auto number. I can get data inserted into the table using the add record w/sql script I downloaded of this site. I don't know VB Script I am just looking for something to modify.<br /><br />Here is what I need help with:<br /><br />1. Does anyone have a script that will help me capture the auto number so that the database know which record to update from the other pages in the survey?<br /><br />2. Should I not use autonumber and kick out a unique ID manually? If so how do I do it?<br /><br />3. Should I use 7 separate tables instead of one table? Would this be easier?<br /><br />4. What about using a session object?<br /><br />Thanks for your help<br />
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : Dave Z (dizidog@aol.com)</b></i><br /><br />lots of questions... one at a time! scroll down<br /><br />------------<br />hammax at 3/8/2000 3:23:18 PM<br /><br />Background:<br /><br />I am trying to create a web survey for one of my professors at the college I attend. The survey is 7 separate pages with the data going into one database file. I am only using text boxes and radio buttons. The database is composed of one table (using Access 97) with all the variables in that one table. The problem I am having is keeping track of each particular person as they go through the survey because they will be more than one person at a time probably no more than 10. I have also been told I am can not use cookies. On the first page of the survey they put in their name, email, etc. Then they assigned an auto number. I can get data inserted into the table using the add record w/sql script I downloaded of this site. I don't know VB Script I am just looking for something to modify.<br /><br />Here is what I need help with:<br /><br />1. Does anyone have a script that will help me capture the auto number so that the database know which record to update from the other pages in the survey?<br /><br />A. As soon as you Insert the data, (Preferably SQL) I would use a recordset object to get the auto number. Like so
Actual line breaks are double spaced)<br /><br />dim conn<br /><br />dim rs<br /><br />dim strconn<br /><br />strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("yourMDB.mdb")<br /><br />set conn = server.createobject("adodb.connection")<br />conn.open strconn<br /><br /><br />SQL = "INSERT INTO Contacts(FirstName, MiddleName, LastName)"&_<br /><br />"VALUES ('"& request("FirstName")&"','"& request("MiddleName") &"',"&_<br /><br />"'" & bless(request("LastName")) &"');"<br /><br /><br />Conn.Execute(SQL)<br /><br />dim AppID<br /><br />set rs1 = Server.CreateObject("ADODB.Recordset") <br /><br />SQL="SELECT AppID FROM Contacts" &_<br />" WHERE ((FirstName ='" & Request.form("FirstName")& "')" &_<br /><br />" AND (LastName ='" & bless(request("LastName")) & "'));"<br /><br />Set rs1 = Conn.Execute(SQL) <br /><br />set AppID = rs1("AppID")%><br /><br />oops, that's two SQL queries...oh well<br /> the bless functions are a replace() for single quotes ( they give errors for names like O'Malley, or words like "don't)<br />then you can pass the AppID variable through hidden form fields.<br /><input type=hidden value= <%=AppID%><br /><br />2. Should I not use autonumber and kick out a unique ID manually? If so how do I do it?<br /><br />A. I would use autonumber. Nothing manual, sounds too much like labor!<br /><br />3. Should I use 7 separate tables instead of one table? Would this be easier?<br /><br />I find separate tables easier to work with, besides I don't believe you can insert data into one table with separate forms. I know you can't insert data into separate tables with one form.<br /><br />4. What about using a session object?<br /><br />A. Sorry, not sure what you mean here.<br /><br />Thanks for your help<br />Hope I did. |
|
#3
|
|||
|
|||
|
<i><b>Originally posted by : hammax (hammax_2000@yahoo.com)</b></i><br />Sorry about so many questions I have been to this site lots of times but I have not ever posted on here before. So what I was talking about a session object, it is keeps track of everything entered in during once instance in the global.asa file, then is write everything into the database all at one time. Do you know what this is about? I will try that script. Thank you so much.<br /><br /><br />------------<br />Dave Z at 3/10/2000 2:33:52 AM<br /><br /><br />lots of questions... one at a time! scroll down<br /><br />------------<br />hammax at 3/8/2000 3:23:18 PM<br /><br />Background:<br /><br />I am trying to create a web survey for one of my professors at the college I attend. The survey is 7 separate pages with the data going into one database file. I am only using text boxes and radio buttons. The database is composed of one table (using Access 97) with all the variables in that one table. The problem I am having is keeping track of each particular person as they go through the survey because they will be more than one person at a time probably no more than 10. I have also been told I am can not use cookies. On the first page of the survey they put in their name, email, etc. Then they assigned an auto number. I can get data inserted into the table using the add record w/sql script I downloaded of this site. I don't know VB Script I am just looking for something to modify.<br /><br />Here is what I need help with:<br /><br />1. Does anyone have a script that will help me capture the auto number so that the database know which record to update from the other pages in the survey?<br /><br />A. As soon as you Insert the data, (Preferably SQL) I would use a recordset object to get the auto number. Like so
Actual line breaks are double spaced)<br /><br />dim conn<br /><br />dim rs<br /><br />dim strconn<br /><br />strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("yourMDB.mdb")<br /><br />set conn = server.createobject("adodb.connection")<br />conn.open strconn<br /><br /><br />SQL = "INSERT INTO Contacts(FirstName, MiddleName, LastName)"&_<br /><br />"VALUES ('"& request("FirstName")&"','"& request("MiddleName") &"',"&_<br /><br />"'" & bless(request("LastName")) &"');"<br /><br /><br />Conn.Execute(SQL)<br /><br />dim AppID<br /><br />set rs1 = Server.CreateObject("ADODB.Recordset") <br /><br />SQL="SELECT AppID FROM Contacts" &_<br />" WHERE ((FirstName ='" & Request.form("FirstName")& "')" &_<br /><br />" AND (LastName ='" & bless(request("LastName")) & "'));"<br /><br />Set rs1 = Conn.Execute(SQL) <br /><br />set AppID = rs1("AppID")%><br /><br />oops, that's two SQL queries...oh well<br /> the bless functions are a replace() for single quotes ( they give errors for names like O'Malley, or words like "don't)<br />then you can pass the AppID variable through hidden form fields.<br /><input type=hidden value= <%=AppID%><br /><br />2. Should I not use autonumber and kick out a unique ID manually? If so how do I do it?<br /><br />A. I would use autonumber. Nothing manual, sounds too much like labor!<br /><br />3. Should I use 7 separate tables instead of one table? Would this be easier?<br /><br />I find separate tables easier to work with, besides I don't believe you can insert data into one table with separate forms. I know you can't insert data into separate tables with one form.<br /><br />4. What about using a session object?<br /><br />A. Sorry, not sure what you mean here.<br /><br />Thanks for your help<br />Hope I did. |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > web survey need help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|