Click to See Complete Forum and Search --> : Getrows + join


luigicannavaro
12-15-2008, 01:56 AM
Dear all,


Could someone please tell me WHY this script does an error message:
Subscript out of range or Type mismatch: 'join'



<%
rs.open "select keyword from keywords where id = 2 ", conn

'set rs = Conn.Execute(SQL)
miTabla = rs.GetRows
'Liberamos los objetos ya!!
rs.Close
set rs = nothing
Conn.Close
set Conn = nothing
Response.Write("<TABLE>")

'Recorremos el vector
'Desde el primero hasta el último "registro"...
for i = 0 to UBound(miTabla,2)
'Abrimos una nueva fila
Response.Write("<TR>")
'Desde el primero hasta el último "campo"...
for J = 0 to Ubound(miTabla, 1)
'Imprimo una celda para cada campo
Response.Write("<TD>" & miTabla(J, I) & "</TD>")
next
Response.Write("</TR>")
next

Response.Write("</TABLE>")


strAdresses = Join(miTabla, " ")

response.write str Addresses%>


<%
rs.Close
conn.Close

%>


Best regards

Luigi

buntine
12-16-2008, 04:51 AM
Find out what the data type and contents of the miTable variable. It is probably null, or something else you are not expecting it to be.

The Join method will only accept an array (or perhaps any enumerable object?).

So, potentially, the "getRows" method is returning null because the SQL query is yielding no results (an empty dataset). I would hope the UBound method crashed out if this was the case, but who knows what is going on when you are dealing with ASP... :/

cheers,
Andy.