Solved

First Element of an ASP recordset not being displayed

Posted on 2003-11-10
3
390 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
Comment Utility
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
Comment Utility
Thanks af500 spot on
0
 
LVL 4

Expert Comment

by:af500
Comment Utility
np ;)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now