populate dropdown from sproc

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?



*** Sent via Developersdex http://www.developersdex.com ***
Mike P [ Di, 24 Juli 2007 15:25 ] [ ID #1777206 ]

Re: populate dropdown from sproc

Mike P wrote:
> 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' :

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"
reb01501 [ Di, 24 Juli 2007 16:15 ] [ ID #1777209 ]

Re: populate dropdown from sproc

Gazing into my crystal ball I observed Mike P <mike.parr [at] gmail.com>
writing in news:O#wBTYfzHHA.5092 [at] TK2MSFTNGP04.phx.gbl:

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

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.

><tr>
> <td bgcolor="cccccc"
> align="center"><nobr><b>Client</nobr></td>

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}

> <select name=CompanyNames>
> <%
> 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
rscompanynames.MOVENext
>
> loop
>
> set rsCompanyNames = nothing
> set objCmd = nothing
> %>
>
> Can anybody help?

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
Adrienne Boswell [ Di, 31 Juli 2007 07:12 ] [ ID #1782951 ]
Webserver » microsoft.public.inetserver.asp.general » populate dropdown from sproc

Vorheriges Thema: File Upload
Nächstes Thema: Good News Mr 142.179.22.210 flood microsoft.public.inetserver.asp.general