Groups | Blog | Home
all groups > inetserver asp general > july 2007 >

inetserver asp general : populate dropdown from sproc


Mike P
7/24/2007 6:25:15 AM
I am trying to populate a dropdown from a stored procedure, but I am
getting the error 'Object doesn't support this property or method:
'Next' :

<!--#include file="include_connection.asp"-->
<!--#include file="adovbs.inc"-->

<%

set objConn = server.createobject("adodb.connection")
objConn.open strConnection

%>
<table>
<form>
<tr>
<td bgcolor="cccccc" align="center"><nobr><b>Client</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>BDD</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Status</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Meeting
Date</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Brief
Received</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Response
Submitted</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Site Visit</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Decision
Due</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Sign Off
Status</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Sign Off
Month</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Go Live</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Activity
Type</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Description</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Number of
Seats</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Commercials</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Duration</nobr></td>
<td bgcolor="cccccc" align="center"><nobr><b>Comments</nobr></td>
</tr>
<tr>
<td bgcolor="cccccc" align="center"><nobr>
<select name=CompanyNames>
<%
set objCmd = server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = strConnection
objCmd.CommandType = adCmdStoredProc
objCmd.CommandText = "GetCompanyNames"
set rsCompanyNames = objCmd.Execute

do while not rsCompanyNames.eof

'if a code has been selected, set it as selected

Response.Write "<option value=" &
rsCompanyNames("companysitekey") & " >"& rsCompanyNames("name")
&"</option>"

rsCompanyNames.Next

loop

set rsCompanyNames = nothing
set objCmd = nothing
%>
</select>
</nobr></td>
<td>BDD</td>
<td></td>
</tr>
</form>
</table>

Can anybody help?



Bob Barrows [MVP]
7/24/2007 10:15:54 AM
[quoted text, click to view]

Please don't multipost. This question was answered in the vbscrpt group you
posted to.

There is no method called Next. It's "MoveNext"


Your code would probably be more efficient if you used Getrows to move the
data into an array, allowing you to close your recordset and database
connection much sooner.

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

Adrienne Boswell
7/31/2007 5:12:07 AM
Gazing into my crystal ball I observed Mike P <mike.parr@gmail.com>
writing in news:O#wBTYfzHHA.5092@TK2MSFTNGP04.phx.gbl:

[quoted text, click to view]

This is OT, but a table, this is bad HTML. The only element that can come
after a table element is CAPTION, THEAD, COL, COLGROUP or TR. The proper
way is FORM then TABLE.

[quoted text, click to view]

Save yourself some time, use the right tools for the job:
<th>Field Title</th> - th is natively bold and centered.
and in the CSS:
th {background-color:#CCC; white-space: nobreak}

[quoted text, click to view]

You would also do better to put this into an array - look up getrows().
Additionally, you might save yourself some time if you used cleaner markup
- have a look at http://intraproducts.com/usenet/requiredform.asp
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
AddThis Social Bookmark Button