recordsets not returning all values

Results 1 to 2 of 2

Thread: recordsets not returning all values

  1. #1
    Join Date
    Dec 1969

    Default recordsets not returning all values

    I have a problem with recordsets sometimes not return all values. For example, I expect a drop down menu to display 5 items that I know exist in my query but I get missing data! (sometimes only one item or the last one not appearing, ect) This doesn&#039;t happen all the time but it should never happen. I&#039;m thinking the recordset is getting truncated somehow. <BR><BR>I&#039;m having this problem on two IIS servers where I have mirror sites with the same code, connection methods, ect... (one with SQL Server 7 and the other SQL server 2000) on one server, it happens pretty often and the other server only occasionally. <BR><BR>Below are the connection objects and a typical list fill from a query that gets truncated. Is this a server problem or is there something wrong with my code? Thanks for your help!!! Marc<BR><BR><BR><BR>Dim MAIN_DATACONN<BR>Dim CONN_STRING<BR><BR>MAIN_DATACONN = "comics"<BR>CONN_STRING="DRIVER={SQL Server};SERVER=SERVERNAME;UID=USERNAME;PWD=PASSWOR D;DATABASE=DATABASENAME"<BR><BR><BR>Function GetDataConn(strConnectionName)<BR>Dim DataConn<BR>Set DataConn = Server.CreateObject("ADODB.Connection")<BR>DataCon n.ConnectionTimeout = 15<BR>DataConn.CommandTimeout = 30<BR>DataConn.Open CONN_STRING<BR>Set GetDataConn = DataConn<BR>End Function<BR><BR><BR>Dim rstData <BR>Dim strSQL<BR><BR>Set DataConn = GetDataConn(MAIN_DATACONN)<BR>Set rstData = Server.CreateObject("ADODB.Recordset")<BR><BR>strS QL = "SELECT FieldName1, FieldName2 FROM TableName WHERE TableName = &#039;SomeCondition&#039;"<BR><BR>rstData.Open strSQL, DataConn, adOpenForwardOnly, adLockReadOnly, adCmdText<BR><BR><BR><BR>If Not rst.EOF Then<BR>&#039; Note same thing happens if using... Do While Not rst.EOF Then<BR><BR>&#060;select name="NAME"&#062;<BR>&#060;%<BR>&#039;Call from db to catch info to populate form<BR><BR>Do Until rstData.EOF<BR>%&#062; <BR><BR>&#060;option value="&#060;%=rstData("FieldName1")%&#062;"&#062; &#060;%=rstData("FieldName2")%&#062;&#060;/option&#062;<BR><BR>&#060;%<BR>rstData.MoveNext<BR >Loop<BR>%&#062; <BR>&#060;/select&#062;<BR><BR>&#060;%<BR>End If<BR><BR>DataConn.Close<BR>Set Dataconn = Nothing<BR>Set rstData = Nothing<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default Nothing wrong with code

    It could be more efficient, but that&#039;s irrelevant. It looks fine.<BR><BR>I&#039;m afraid you&#039;ll have to do a bit of debugging to try to track this one down.<BR><BR>I don&#039;t see how something this simple could "drop out" a record from a set of records.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts