Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get records from database then pass them to flash as an array

Status
Not open for further replies.

ktai

IS-IT--Management
Jan 11, 2005
22
US
Hi,
I am having so many problems trying to do a seemingly simple thing. This ASP code is supposed to find record(s) in the access database with a certain last name and then pass the respective first names to Flash as an array. Please take a look at the code and see if you can help.

Code:
Dim oRS, oConn, oRS2, counter, numberrecords

 Set oRS = Server.CreateObject("ADODB.Recordset")
 Set oRS2 = Server.CreateObject("ADODB.Recordset")
 Set oConn = Server.CreateObject("ADODB.Connection")

 oConn.Open = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("database.mdb")

 oRS2.Open "SELECT Count(*) AS intTotal FROM tblUsers WHERE LastName='" & Request.QueryString("lastnamesearch") & "'", oConn, 2, 3
 oRS.Open "SELECT * FROM tblUsers WHERE LastName='" & Request.QueryString("lastnamesearch") & "'", oConn, 2, 3
 numberrecords=oRS2("intTotal")
 counter=1
Response.Write "numberrecords=" & oRS2("intTotal")

if NOT oRS.EOF then
	[COLOR=red]For counter = 1 to numberrecords
		Response.Write "&thisarray[" & counter & "]=" & oRS("FirstName") 
		oRS.MoveNext
	Next[/color]
end if

 If oRS.EOF Then
	Response.Write "&firstname=Not+Found&lastname=Not+Found&grade=Not+Found"
 Else	
 	Response.Write "&firstname=" & Server.URLEncode(oRS("FirstName")) & "&lastname=" & Server.URLEncode(oRS("LastName")) & "&grade=" & Server.URLEncode(oRS("Grade"))
 End If
oRS.Close
Set oRS = Nothing
oRS2.Close
Set oRS2 = Nothing
oConn.Close
Set oConn = Nothing

In case you are wondering, this is (for now) going to be used to lookup student information. The reason why I am going through the trouble of using the loop and the array is because many students have the same last name and I want all of the students with the same last name to show up instead of just the first record. Also, like I said, this is passing variables to a flash (.swf) file that I have in the same directory.
 
can i have the error that it states???

Known is handfull, Unknown is worldfull
 
Take a look at the GetRows method of the recordset object. It might help with the array.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top