Hi,
I have an ASP page that I created. It opens a recordset, and puts the values into an array using getrows.
There are only two records in the database. (access)
Now the problem is that when I get the ubound of the array, instead of returning 1 - which would be correct, it returns 3.... this means I get a error when the page tries to display 2 and 3 as they do not exist.
Anyone got any ideas? My Code is below..
Code:
<%
if Session("firstrun") = 0 then
set dataconnection = server.CreateObject ("ADODB.CONNECTION")
set datacommand = server.CreateObject ("ADODB.Command")
set recordset = server.CreateObject ("ADODB.recordset")
dataconnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=demo.mdb;"
dataconnection.Open
datacommand.ActiveConnection = DataConnection
txtsql = "SELECT * FROM mess"
datacommand.CommandText = txtsql
recordset.Open datacommand
dim myarray
myarray = recordset.GetRows
RecordSet.Close
Set RecordSet = Nothing
Set datacommand = Nothing
DataConnection.Close
Set DataConnection = Nothing
Session("firstrun") = 1
else
myarray = Session("myarray1")
i = session("i")
end if
%>
<%
response.write "Ubound"
response.write ubound(myarray)
response.write "<BR>"
if i > ubound(myarray) then
session("firstrun")= 0
else
response.write myarray(0,i)
response.write myarray(1,i)
response.write myarray(2,i)
response.write myarray(3,i)
response.write session("firstrun")
response.write session("i")
i = i +1
session("i") = i
end if
%>