Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

First Element of an ASP recordset not being displayed

Posted on 2003-11-10
3
Medium Priority
?
400 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 2000 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 have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

609 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