Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | Help with some Javascript code

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > General IT Discussion
Register FAQ Community Calendar

ASP Problem
Reply
 
Thread Tools
Old 06-05-2004, 15:20   #1
gazzae
Inactive
 
gazzae's Avatar
 
Join Date: Jun 2003
Location: Belfast
Age: 46
Posts: 4,594
gazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronze
gazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronze
ASP Problem

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
%>
gazzae is offline   Reply With Quote
Advertisement
Old 07-05-2004, 12:58   #2
gazzae
Inactive
 
gazzae's Avatar
 
Join Date: Jun 2003
Location: Belfast
Age: 46
Posts: 4,594
gazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronze
gazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronzegazzae is cast in bronze
Re: ASP Problem

DOH!!! I'm so stupid!

Because its a 2d array I should have got the Ubound by using - Ubound(myarray, 2)

It works now!
gazzae is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 14:43.


Server: lithium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum