Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Another Drop List question

Reply
Thread Tools

Another Drop List question

 
 
C White
Guest
Posts: n/a
 
      01-19-2005
I've got another drop list problem

I am using the following code where users select a name, but it should
pass a name and email into the table

<select name="user">
<option value="<% Response.Write (rsUser("Name")) %>">
<% Response.Write (rsUser("Name")) %>
<input type="hidden" name="Email" value="<% Response.Write
(rsUser("Email")) %>">
</option>
</select>
everything seems to be ok when i test the form as the source it produces
is this:

<select name="user">
<option value="1st guy">
1st guy
<input type="hidden" name="Email" value="">
</option>

<option value="2nd guy">
2nd guy
<input type="hidden" name="Email" value="">
</option>
</select>

so everything seems fine, it is pulling the information from the 1st
table just fine, but when i submit to add the information to the 2nd
table it does not add the email value, i get the following error

Microsoft JET Database Engine (0x80004005)
Field 'Table.Email' cannot be a zero-length string.

if i change the email field in the table to allow zero length i don't
get the error, but the email does not go into the table, just the name
is added (it's an access 2000 database)

any ideas what i am doing wrong here?

thanks
 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-19-2005
C White wrote:
<snip>> if i change the email field in the table to allow zero length i
don't
> get the error, but the email does not go into the table, just the name
> is added (it's an access 2000 database)
>
> any ideas what i am doing wrong here?
>

Impossible to say without seeing the code used to add the data to the
database

--
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
"NO SPAM"


 
Reply With Quote
 
 
 
 
C White
Guest
Posts: n/a
 
      01-19-2005
Sorry bout that, I wasn't sure if anyone would want it, here it is:

<%

'declare your variables
Dim Name, Email
Dim sConnString, connection, sSQL

' Receiving values from Form, assign the values entered to variables
Name = Request.Form("Name")
Email = Request.Form("Email")

'declare SQL statement that will query the database
sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
Email & "')"

'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("User_Info.mdb")


'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")

'Open the connection to the database
connection.Open(sConnString)

'execute the SQL
connection.execute(sSQL)

response.write "The agent information was successfully submitted."

' Done. Close the connection object
connection.Close
Set connection = Nothing
%>

Bob Barrows [MVP] wrote:

> C White wrote:
> <snip>> if i change the email field in the table to allow zero length i
> don't
>
>>get the error, but the email does not go into the table, just the name
>>is added (it's an access 2000 database)
>>
>>any ideas what i am doing wrong here?
>>

>
> Impossible to say without seeing the code used to add the data to the
> database
>

 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      01-19-2005
"C White" wrote in message news:6cOdnZ5EAf5ecXPcRVn-...
: I've got another drop list problem
:
: I am using the following code where users select a name, but it should
: pass a name and email into the table
:
: <select name="user">
: <option value="<% Response.Write (rsUser("Name")) %>">
: <% Response.Write (rsUser("Name")) %>
: <input type="hidden" name="Email" value="<% Response.Write
: (rsUser("Email")) %>">
: </option>
: </select>
: everything seems to be ok when i test the form as the source it produces
: is this:
:
: <select name="user">
: <option value="1st guy">
: 1st guy
: <input type="hidden" name="Email" value="">
: </option>
:
: <option value="2nd guy">
: 2nd guy
: <input type="hidden" name="Email" value="">
: </option>
: </select>
:
: so everything seems fine, it is pulling the information from the 1st
: table just fine, but when i submit to add the information to the 2nd
: table it does not add the email value, i get the following error
:
: Microsoft JET Database Engine (0x80004005)
: Field 'Table.Email' cannot be a zero-length string.
:
: if i change the email field in the table to allow zero length i don't
: get the error, but the email does not go into the table, just the name
: is added (it's an access 2000 database)
:
: any ideas what i am doing wrong here?

Two things:

1. If your database field is set to not allow zero-length strings, then it
needs data. This is not the code where you insert the data, it is the code
where you are showing values you have received from the data. Have you
verified the data is not present in the database? Are you getting an error
when you insert data or do you have an On Error Resume Next line in your
insert code?

2. I have found it is often easier and possibly less of a performance hit if
you put your HTML in strings and then pass them through a routine to write
it to the page.

Ex.

<%@ Language=VBScript %>
<%
..
..
..

sub prt(str)
Response.Write(str & vbCrLf)
end sub

dim s
s = "<select name=""user"">" & vbCrLf & _
"<option value=""" & rsUser("Name") & """>" & rsUser("Name") & vbCrLf & _
"<input type=""hidden"" name=""Email"" value=""" & rsUser("Email") & """>"
& vbCrLf & _
"</option>" & vbCrLf & _
"</select>"

prt s

%>

I like this better because my server is not switching back and forth to read
ASP code and HTML and for me, it makes it easier to line up my quotes. I
know that my string needs quotes and if I assign a value to an HTML element
that I need 3, otherwise, adding quotes for HTML means I need 2. So, single
around the edges, 2 for all HTML values and 3 if I need to pass a value from
ASP.

This:
& vbCrLf

....adds a carriage return, line feed to the HTML output so the code is more
legible. It has nothing to do with how the code runs.

& _ could probably be shortened to just _ which is a concatentation
character so VBScript code can resume on the next line.

I'm building a string that gets passed once and my parser reads the whole
page, rather than switching back and forth to read ASP, HTML, ASP, etc. I
am told this is how the parser works. I could redefine "s" as above, or I
could even have an array of statements, but it gives me better control over
the output of my data.

instead of ...

<%@ Language=VBScript %>
<%
..
..
..
%>
<select name="user">
<option value="<% Response.Write (rsUser("Name")) %>">
<% Response.Write (rsUser("Name")) %>
<input type="hidden" name="Email" value="<% Response.Write
(rsUser("Email")) %>">
</option>
</select>
<%
....
%>

....at the very least you could replace the Response.Writes with =

<select name="user">
<option value="<% = rsUser("Name") %>">
<% = rsUser("Name") %>
<input type="hidden" name="Email" value="<% = rsUser("Email") %>">
</option>
</select>

HTH...

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
C White
Guest
Posts: n/a
 
      01-19-2005
Roland Hall wrote:

> "C White" wrote in message news:6cOdnZ5EAf5ecXPcRVn-...
> : I've got another drop list problem
> :
> : I am using the following code where users select a name, but it should
> : pass a name and email into the table
> :
> : <select name="user">
> : <option value="<% Response.Write (rsUser("Name")) %>">
> : <% Response.Write (rsUser("Name")) %>
> : <input type="hidden" name="Email" value="<% Response.Write
> : (rsUser("Email")) %>">
> : </option>
> : </select>
> : everything seems to be ok when i test the form as the source it produces
> : is this:
> :
> : <select name="user">
> : <option value="1st guy">
> : 1st guy
> : <input type="hidden" name="Email" value="">
> : </option>
> :
> : <option value="2nd guy">
> : 2nd guy
> : <input type="hidden" name="Email" value="">
> : </option>
> : </select>
> :
> : so everything seems fine, it is pulling the information from the 1st
> : table just fine, but when i submit to add the information to the 2nd
> : table it does not add the email value, i get the following error
> :
> : Microsoft JET Database Engine (0x80004005)
> : Field 'Table.Email' cannot be a zero-length string.
> :
> : if i change the email field in the table to allow zero length i don't
> : get the error, but the email does not go into the table, just the name
> : is added (it's an access 2000 database)
> :
> : any ideas what i am doing wrong here?
>
> Two things:
>
> 1. If your database field is set to not allow zero-length strings, then it
> needs data. This is not the code where you insert the data, it is the code
> where you are showing values you have received from the data. Have you
> verified the data is not present in the database? Are you getting an error
> when you insert data or do you have an On Error Resume Next line in your
> insert code?
>
> 2. I have found it is often easier and possibly less of a performance hit if
> you put your HTML in strings and then pass them through a routine to write
> it to the page.
>
> Ex.
>
> <%@ Language=VBScript %>
> <%
> .
> .
> .
>
> sub prt(str)
> Response.Write(str & vbCrLf)
> end sub
>
> dim s
> s = "<select name=""user"">" & vbCrLf & _
> "<option value=""" & rsUser("Name") & """>" & rsUser("Name") & vbCrLf & _
> "<input type=""hidden"" name=""Email"" value=""" & rsUser("Email") & """>"
> & vbCrLf & _
> "</option>" & vbCrLf & _
> "</select>"
>
> prt s
>
> %>
>
> I like this better because my server is not switching back and forth to read
> ASP code and HTML and for me, it makes it easier to line up my quotes. I
> know that my string needs quotes and if I assign a value to an HTML element
> that I need 3, otherwise, adding quotes for HTML means I need 2. So, single
> around the edges, 2 for all HTML values and 3 if I need to pass a value from
> ASP.
>
> This:
> & vbCrLf
>
> ...adds a carriage return, line feed to the HTML output so the code is more
> legible. It has nothing to do with how the code runs.
>
> & _ could probably be shortened to just _ which is a concatentation
> character so VBScript code can resume on the next line.
>
> I'm building a string that gets passed once and my parser reads the whole
> page, rather than switching back and forth to read ASP, HTML, ASP, etc. I
> am told this is how the parser works. I could redefine "s" as above, or I
> could even have an array of statements, but it gives me better control over
> the output of my data.
>
> instead of ...
>
> <%@ Language=VBScript %>
> <%
> .
> .
> .
> %>
> <select name="user">
> <option value="<% Response.Write (rsUser("Name")) %>">
> <% Response.Write (rsUser("Name")) %>
> <input type="hidden" name="Email" value="<% Response.Write
> (rsUser("Email")) %>">
> </option>
> </select>
> <%
> ...
> %>
>
> ...at the very least you could replace the Response.Writes with =
>
> <select name="user">
> <option value="<% = rsUser("Name") %>">
> <% = rsUser("Name") %>
> <input type="hidden" name="Email" value="<% = rsUser("Email") %>">
> </option>
> </select>
>
> HTH...
>

HI

1. I checked the database, it's not inserting the email value

2. You've given me a lot of examples and explanations to read, thank you
very much, these will help and i'll let you know if this helps.
 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-19-2005
C White wrote:
> Sorry bout that, I wasn't sure if anyone would want it, here it is:
>
> <%
>
> 'declare your variables
> Dim Name, Email
> Dim sConnString, connection, sSQL
>
> ' Receiving values from Form, assign the values entered to variables
> Name = Request.Form("Name")
> Email = Request.Form("Email")


You need validation code here to ensure these variables contain what you
expect. Use the len() function to verify that they contain data.
>
> 'declare SQL statement that will query the database
> sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
> Email & "')"
>


Since you are having a possible sql problem, you need to use basic debugging
to make sure the sql statement contains what you expect:

Response.Write sSQL
Response.End

You can comment out the above lines when finished debugging. We need to see
the resulting statement from the browser window. When using concatenation to
create a dynamic sql statement, your goal is to create a statement that will
run as-is in your database's query execution tool (the Access Query Builder)

> connection.Open(sConnString)


Parentheses are not needed
http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx

>
> 'execute the SQL
> connection.execute(sSQL)


Tell ADO what the command type is (adCmdText = 1) and that you are not
expecting any records back so it does not waste time and resources behind
the scenes creating a recordset to receive the resultset (adExecuteNoRecords
= 12

connection.execute sSQL,,129 '1 + 128 = 129


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
"NO SPAM"


 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      01-20-2005
"C White" wrote in message news:Vv2dnYg85rE2bHPcRVn-...
: Sorry bout that, I wasn't sure if anyone would want it, here it is:
:
: <%
:
: 'declare your variables
: Dim Name, Email
: Dim sConnString, connection, sSQL
:
: ' Receiving values from Form, assign the values entered to variables
: Name = Request.Form("Name")
: Email = Request.Form("Email")
:
: 'declare SQL statement that will query the database
: sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
: Email & "')"
:
: 'define the connection string, specify database
: 'driver and the location of database
: sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
: "Data Source=" & Server.MapPath("User_Info.mdb")
:
:
: 'create an ADO connection object
: Set connection = Server.CreateObject("ADODB.Connection")
:
: 'Open the connection to the database
: connection.Open(sConnString)
:
: 'execute the SQL
: connection.execute(sSQL)
:
: response.write "The agent information was successfully submitted."
:
: ' Done. Close the connection object
: connection.Close
: Set connection = Nothing
: %>

Where do you verify that the form fields have values? Is that done on the
client side?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
C White
Guest
Posts: n/a
 
      01-20-2005
Bob Barrows [MVP] wrote:

> C White wrote:
>
>>Sorry bout that, I wasn't sure if anyone would want it, here it is:
>>
>><%
>>
>>'declare your variables
>>Dim Name, Email
>>Dim sConnString, connection, sSQL
>>
>>' Receiving values from Form, assign the values entered to variables
>>Name = Request.Form("Name")
>>Email = Request.Form("Email")

>
>
> You need validation code here to ensure these variables contain what you
> expect. Use the len() function to verify that they contain data.
>
>>'declare SQL statement that will query the database
>>sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
>>Email & "')"
>>

>
>
> Since you are having a possible sql problem, you need to use basic debugging
> to make sure the sql statement contains what you expect:
>
> Response.Write sSQL
> Response.End
>
> You can comment out the above lines when finished debugging. We need to see
> the resulting statement from the browser window. When using concatenation to
> create a dynamic sql statement, your goal is to create a statement that will
> run as-is in your database's query execution tool (the Access Query Builder)
>
>
>>connection.Open(sConnString)

>
>
> Parentheses are not needed
> http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx
>
>
>>'execute the SQL
>>connection.execute(sSQL)

>
>
> Tell ADO what the command type is (adCmdText = 1) and that you are not
> expecting any records back so it does not waste time and resources behind
> the scenes creating a recordset to receive the resultset (adExecuteNoRecords
> = 12
>
> connection.execute sSQL,,129 '1 + 128 = 129
>
>
> Bob Barrows


the debugging code shows me the following, (when i set the database to
allow zero length)

INSERT into Users (Name, Email) values ('1st guy', '')

if i move the hidden email field outside of my select code and just set
it to

<input type="hidden" name="TL_Email" value="">

everything works fine and it inserts the email, so this leeds me to
beleive that there is indeed somethig wrong with the code I am using to
create the drop box and that I should look at another way of doing it

here is the full code i am using to generate the drop list

<select name="Name">
<%
'Dimension variables
Dim adoConName 'Holds the Database Connection Object
Dim rsName 'Holds the recordset for the records in the database
Dim strSQLName 'Holds the SQL query for the database

'Create an ADO connection object
Set adoConName = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoConName.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("User_Info.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsName = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQLName = "SELECT * FROM Names ORDER by Name ASC;"

'Open the recordset with the SQL query
rsName.Open strSQLName, adoConName

'Loop through the recordset
Do While not rsName.EOF
%>
<option value="<% Response.Write (rsName("Name")) %>">
<% Response.Write (rsName("Name")) %>
</option>
<input type="hidden" name="Email" value="<% Response.Write
(rsName("Email")) %>">
<%
'Move to the next record in the recordset
rsName.MoveNext

Loop

'Reset server objects
rsName.Close
Set rsName = Nothing
Set adoConName = Nothing
%>
</select>

if anyone has suggestions please submit them, in the meantime i will
re-evaluate how i am generating the drop box
 
Reply With Quote
 
C White
Guest
Posts: n/a
 
      01-20-2005
Bob Barrows [MVP] wrote:

> C White wrote:
>
>>Sorry bout that, I wasn't sure if anyone would want it, here it is:
>>
>><%
>>
>>'declare your variables
>>Dim Name, Email
>>Dim sConnString, connection, sSQL
>>
>>' Receiving values from Form, assign the values entered to variables
>>Name = Request.Form("Name")
>>Email = Request.Form("Email")

>
>
> You need validation code here to ensure these variables contain what you
> expect. Use the len() function to verify that they contain data.
>
>>'declare SQL statement that will query the database
>>sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
>>Email & "')"
>>

>
>
> Since you are having a possible sql problem, you need to use basic debugging
> to make sure the sql statement contains what you expect:
>
> Response.Write sSQL
> Response.End
>
> You can comment out the above lines when finished debugging. We need to see
> the resulting statement from the browser window. When using concatenation to
> create a dynamic sql statement, your goal is to create a statement that will
> run as-is in your database's query execution tool (the Access Query Builder)
>
>
>>connection.Open(sConnString)

>
>
> Parentheses are not needed
> http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx
>
>
>>'execute the SQL
>>connection.execute(sSQL)

>
>
> Tell ADO what the command type is (adCmdText = 1) and that you are not
> expecting any records back so it does not waste time and resources behind
> the scenes creating a recordset to receive the resultset (adExecuteNoRecords
> = 12
>
> connection.execute sSQL,,129 '1 + 128 = 129
>
>
> Bob Barrows

the debugging code shows me the following, (when i set the database to
allow zero length)

INSERT into Users (Name, Email) values ('1st guy', '')

if i move the hidden email field outside of my select code and just set
it to

<input type="hidden" name="TL_Email" value="">

everything works fine and it inserts the email, so this leeds me to
beleive that there is indeed somethig wrong with the code I am using to
create the drop box and that I should look at another way of doing it

here is the full code i am using to generate the drop list

<select name="Name">
<%
'Dimension variables
Dim adoConName 'Holds the Database Connection Object
Dim rsName 'Holds the recordset for the records in the database
Dim strSQLName 'Holds the SQL query for the database

'Create an ADO connection object
Set adoConName = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less
connection
adoConName.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
Server.MapPath("User_Info.mdb")

'Set an active connection to the Connection object using DSN connection
'adoCon.Open "DSN=guestbook"

'Create an ADO recordset object
Set rsName = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database
strSQLName = "SELECT * FROM Names ORDER by Name ASC;"

'Open the recordset with the SQL query
rsName.Open strSQLName, adoConName

'Loop through the recordset
Do While not rsName.EOF
%>
<option value="<% Response.Write (rsName("Name")) %>">
<% Response.Write (rsName("Name")) %>
</option>
<input type="hidden" name="Email" value="<% Response.Write
(rsName("Email")) %>">
<%
'Move to the next record in the recordset
rsName.MoveNext

Loop

'Reset server objects
rsName.Close
Set rsName = Nothing
Set adoConName = Nothing
%>
</select>

if anyone has suggestions please submit them, in the meantime i will
re-evaluate how i am generating the drop box
 
Reply With Quote
 
Roland Hall
Guest
Posts: n/a
 
      01-20-2005
"C White" wrote in message news:RuCdnabGy885Z3PcRVn-...
: Bob Barrows [MVP] wrote:
:
: > C White wrote:
: >
: >>Sorry bout that, I wasn't sure if anyone would want it, here it is:
: >>
: >><%
: >>
: >>'declare your variables
: >>Dim Name, Email
: >>Dim sConnString, connection, sSQL
: >>
: >>' Receiving values from Form, assign the values entered to variables
: >>Name = Request.Form("Name")
: >>Email = Request.Form("Email")
: >
: >
: > You need validation code here to ensure these variables contain what you
: > expect. Use the len() function to verify that they contain data.
: >
: >>'declare SQL statement that will query the database
: >>sSQL = "INSERT into users (Name, Email) values ('" & Name & "', '" &
: >>Email & "')"
: >>
: >
: >
: > Since you are having a possible sql problem, you need to use basic
debugging
: > to make sure the sql statement contains what you expect:
: >
: > Response.Write sSQL
: > Response.End
: >
: > You can comment out the above lines when finished debugging. We need to
see
: > the resulting statement from the browser window. When using
concatenation to
: > create a dynamic sql statement, your goal is to create a statement that
will
: > run as-is in your database's query execution tool (the Access Query
Builder)
: >
: >
: >>connection.Open(sConnString)
: >
: >
: > Parentheses are not needed
: > http://blogs.msdn.com/ericlippert/ar.../15/52996.aspx
: >
: >
: >>'execute the SQL
: >>connection.execute(sSQL)
: >
: >
: > Tell ADO what the command type is (adCmdText = 1) and that you are not
: > expecting any records back so it does not waste time and resources
behind
: > the scenes creating a recordset to receive the resultset
(adExecuteNoRecords
: > = 12
: >
: > connection.execute sSQL,,129 '1 + 128 = 129
: >
: >
: > Bob Barrows
:
: the debugging code shows me the following, (when i set the database to
: allow zero length)
:
: INSERT into Users (Name, Email) values ('1st guy', '')
:
: if i move the hidden email field outside of my select code and just set
: it to
:
: <input type="hidden" name="TL_Email" value="">
:
: everything works fine and it inserts the email, so this leeds me to
: beleive that there is indeed somethig wrong with the code I am using to
: create the drop box and that I should look at another way of doing it
:
: here is the full code i am using to generate the drop list
:
: <select name="Name">
: <%
: 'Dimension variables
: Dim adoConName 'Holds the Database Connection Object
: Dim rsName 'Holds the recordset for the records in the database
: Dim strSQLName 'Holds the SQL query for the database
:
: 'Create an ADO connection object
: Set adoConName = Server.CreateObject("ADODB.Connection")
:
: 'Set an active connection to the Connection object using a DSN-less
: connection
: adoConName.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
: Server.MapPath("User_Info.mdb")
:
: 'Set an active connection to the Connection object using DSN connection
: 'adoCon.Open "DSN=guestbook"
:
: 'Create an ADO recordset object
: Set rsName = Server.CreateObject("ADODB.Recordset")
:
: 'Initialise the strSQL variable with an SQL statement to query the
database
: strSQLName = "SELECT * FROM Names ORDER by Name ASC;"
:
: 'Open the recordset with the SQL query
: rsName.Open strSQLName, adoConName
:
: 'Loop through the recordset
: Do While not rsName.EOF
: %>
: <option value="<% Response.Write (rsName("Name")) %>">
: <% Response.Write (rsName("Name")) %>
: </option>
: <input type="hidden" name="Email" value="<% Response.Write
: (rsName("Email")) %>">
: <%
: 'Move to the next record in the recordset
: rsName.MoveNext
:
: Loop
:
: 'Reset server objects
: rsName.Close
: Set rsName = Nothing
: Set adoConName = Nothing
: %>
: </select>
:
: if anyone has suggestions please submit them, in the meantime i will
: re-evaluate how i am generating the drop box

Why is the hidden field inside the select? Are you associating different
email addresses with different names? If so, there are probably numerous
ways you could do that but one would be to have a hidden email list, not
just a hidden field and when posting your form, the index into the select
provides the index into your hidden list of email addresses and then
populates a hidden field in your form, outside of the select before
submitting. This way when the form is posted, the selected index provides
the name and the other [hidden or not hidden] element in the form for the
email address. Otherwise it appears all of your email addresses posted will
be blank.

I'm surprised that you do not get an error in your insert if the field is
set to require data for a record.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp


 
Reply With Quote
 
 
 
Reply

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
Affecting a dynamically created drop down from another dynamically created drop down. msimmons ASP .Net 0 07-16-2009 03:17 PM
Appending a list's elements to another list using a list comprehension Debajit Adhikary Python 17 10-18-2007 06:45 PM
retrive preselected value in second drop down list from the first drop down list weiwei ASP .Net 0 01-05-2007 07:29 PM
Auto Drop down a Drop Down List xxbmichae1@supergambler.com Javascript 5 11-23-2005 01:35 AM
New to .NET, can I have one drop down box control the data of another drop down box using a database? SirPoonga ASP .Net 2 01-07-2005 10:44 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57