AspGerman Wiki

Bearbeiten

Wie bekomme ich meine Recordsets auf die clientseite um sie dort in Skripts verwenden zu können?

Indem man serverseitig auf der Clientseite Arrays aufbaut...

Hier die Lösung für VBS bzw. JS als clientseitige Sprache:

<%    
' USAGE: response.write rs2JSArray(rsName,varName)
function rs2JSArray(rs,v)
	dim x,a,r, i,j
	a = rs.GetRows
	x = "var " & v & " = new Array();" & vbCrLf
	for j = 0 to ubound(a,2)
		r=""
		for i = 0 to ubound(a,1)
			r = r & ",'" & a(i,j) & "'"
		next
		r = mid(r,2)
		x = x & v & "["&j&"] = new Array(" & r & ");" & vbCrLf
	next
	rs2JSArray=x
end function

' USAGE: response.write rs2VBArray(rsName,varName)
function rs2VBArray(rs,v)
	dim x,a, i,j
	a = rs.GetRows
	x = "dim " & v & "("&ubound(a,2)&","&ubound(a,1)&")" & vbCrLf
	for j = 0 to ubound(a,2)
		for i = 0 to ubound(a,1)
			x = x & v & "("&j&","&i&")=""" & a(i,j) & """"
			if i<>ubound(a,1) then x = x & ":"
		next
		x = x & vbCrLf
	next
	rs2VBArray=x
end function
%>

ScrewTurn Wiki version 2.0.33. Some of the icons created by FamFamFam.