:: Forum >>

Regarding Asp.NET with ActiveWidgets

I am a new user of ActiveWidgets and I got an error in my Asp.net code so please Help me,
here is my Code, i have just convert this code from asp to asp.net.

Please tell me where i have to made a correction.


<%@ Language="vb" AutoEventWireup="false" Codebehind="test.aspx" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb.OleDbException" %>
<%@ Import Namespace="System.Data.OleDb" %>

<Script Runat=server>
Public Class test1
Dim ds1 As New DataSet
Sub Page_Load( s1 As Object, e As EventArgs )
Dim S As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\example.mdb"
Dim ds1 As New DataSet
Dim conn As New OleDb.OleDbConnection(s)
Dim sql As String
sql = "select * from table"
Dim adapt As New OleDb.OleDbDataAdapter(sql, conn)
Try
conn.Open()
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
If conn.State = ConnectionState.Open Then
Try
adapt.Fill(ds1, "table")
conn.Close()
Catch ex As Exception
Console.WriteLine(ex.ToString)
End Try
Else
Console.WriteLine("State = Closed")
End If
End Sub

Public Function aw_string(s2)

s2 = Replace(s2, "\", "\\")
s2 = Replace(s2, """", "\""") 'replace javascript control characters - ", \
rem s2 = Replace(s2, vbCr, "\r")
rem s2= Replace(s2, vbLf, "\n")

aw_string = """" & s2 & """"

End Function

Public function aw_headers(ds1)

Dim i, count, headers()

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

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

end function

Public function Retrive(ds1)
Dim table As DataTable
Dim col_count, row_count, columns(), rows()
row_count = 0
ReDim columns(col_count-1)
table = ds1.Tables("table")
Dim col As DataColumn
Dim row As DataRow
Dim i As Integer
For i=0 to col_count-1
columns(i) = aw_string((i))
Next
ReDim preserve rows(row_count)
For i = 0 To table.Rows.Count - 1
row = aw_string(table.Rows(i))
rows(row_count) = vbTab & "[" & Join(columns, ", ") & "]"
row_count = row_count + 1
Next
end function



End Class

</Script>

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

</style>
<script>

// insert javascript arrays produced by ASP functions
var myHeaders = "<%# aw_headers(ds1) %>" // Here i got an errors
var myCells = "<%# aw_cells(ds1) %>"
// 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>
Ashish
Saturday, July 29, 2006
/javascript.forum.15428.0/asp-net-ado-net-example.html
Alex (ActiveWidgets)
Monday, July 31, 2006

This topic is archived.


Back to support forum

Forum search