Solved

First Element of an ASP recordset not being displayed

Posted on 2003-11-10
3
393 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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