:: Forum >> Version 2 >>

Getting blank pages with sample

I'm running ActiveWidets using ASP and MS SQL on the back end. I'm trying to use one of the ASP samples provided on this site. I can successfully see the grid when I use a sample that has the data in it. Also, when I modify one of the other samples to look at my database, the queried records are displayed when I "View Source". The actual page is blank however. Any ideas what's wrong? My source is below:

<%@ LANGUAGE = VBScript %>
<%
Dim oConnection
Dim oRecordset

Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "driver={SQL Server};server=myservernamehere;uid=administrators;pwd=;database=mydatabase;Trusted_Connection=yes"

Set oRecordset = oConnection.Execute("SELECT * FROM tbl_Patient")

function aw_string(s)

if s<>"" then
s = Replace(s, "\", "\\")
s = Replace(s, """", "\""") 'replace javascript control characters - ", \
rem s = Replace(s, vbCr, "\r")
rem s = Replace(s, vbLf, "\n")

aw_string = """" & s & """"
else
aw_string=""
end if

end function

function aw_headers(oRecordset)

Dim i, count, headers()

count = oRecordset.fields.count
ReDim headers(count-1)

For i=0 to count-1
headers(i) = aw_string(oRecordset(i).name)
Next

Response.write("[" & Join(headers, ", ") & "];")

end function

function aw_cells(oRecordset)

Dim i, col_count, row_count, columns(), rows()

row_count = 0
col_count = oRecordset.fields.count
ReDim columns(col_count-1)

Do while (Not oRecordset.eof)

For i=0 to col_count-1
columns(i) = aw_string(oRecordset(i))
Next

ReDim preserve rows(row_count)

rows(row_count) = vbTab & "[" & Join(columns, ", ") & "]"
row_count = row_count + 1

oRecordset.MoveNext
Loop

Response.write("[" & vbNewLine & Join(rows, "," & vbNewLine) & vbNewLine & "];" & vbNewLine)

end function
%>
<html>
<head>

<!--#include file="_inc/Validatelogin.asp"-->

<script src="runtime/lib/aw.js"></script>
<link href="runtime/styles/xp/aw.css" rel="stylesheet"></link>
</head>
<body>
<style>
</style>

<script>

// insert javascript arrays produced by ASP functions
var myHeaders = <%= aw_headers(oRecordset) %>
var myCells = <%= aw_cells(oRecordset) %>
// create grid control
var obj = new AW.UI.Grid;
// set grid text
obj.setHeaderText(myHeaders);
obj.setCellText(myCells);
// set number of columns/rows
obj.setColumnCount(myHeaders.length);
obj.setRowCount(myCells.length);
// write grid to the page
document.write(obj);
</script>
</body>

</html>
<%
oRecordset.close
oConnection.close
%>
Brian
Saturday, November 11, 2006



This topic is archived.

Back to support forum

Forum search