Solved

First Element of an ASP recordset not being displayed

Posted on 2003-11-10
3
395 Views
Last Modified: 2008-03-10
I am having problems with an ASP recordset
I am getting data back but it always returns minus the first row in the table

here is the code

btw I am using to populate a drop down box

Dim oConn
  Dim oRS, oRSD
  Dim adOpenKeyset
  Dim adLockOptimistic
  adOpenKeyset = 1
  adLockOptimistic = 3
 
  Set oConn=Server.CreateObject("ADODB.connection")
  Set oRS=Server.CreateObject("ADODB.Recordset")
  strSource = "Provider=SQLOLEDB;Data Source=(local)"
  strSource = strSource & ";User ID=;Password=;InitialCatalog=Project"
  oConn.ConnectionString = strSource
  oConn.Open

sqltext = "SELECT UserID FROM profile " 
  oRS.Open sqltext, oConn

Response.Write "<SELECT name=UserID> "
      Response.Write oRS.getString(,-1,"","<option>","</option>")
      Response.Write "</SELECT>"
0
Comment
Question by:michealo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
af500 earned 500 total points
ID: 9716933
try this:

<select name="name">
<%
Set oRs=Server.CreateObject("adodb.recordset")
strSQL = "SELECT UserID FROM profile"
oRs.Open strSQL, conn

do while not ors.eof
      Response.Write "<OPTION VALUE = '" & oRS (0) & "' SELECTED>"
      Response.Write oRs(0) & "</Option>"
      oRs.MoveNext
loop

%>
</select>
0
 

Author Comment

by:michealo
ID: 9717356
Thanks af500 spot on
0
 
LVL 4

Expert Comment

by:af500
ID: 9717487
np ;)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question