E:\web\learnaspcom\htdocs\freebook\learn\ubtoc.xml LearnAsp.com - ASP ASP.net Free Lessons
Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll
<Asp.net blog>
<personal site>
xxx

Utility Belt:Xray Demo
by Charles Carroll

The code below calls "Utility Belt" functions.

The enhanced Tracing functions is one demo of Array "Utility Belt" functionality including tracing of arrays, hashtables, datatables and dataset.

   filename=/experiments/utilitybelt/vercurrent/ubdemo_xray.aspx

<Test Script Below>


<%@ debug="true"%>
<%@ Import Namespace="System.data"%>
<%@ Import Namespace="LearnAsp.UtilityBelt"%>
<%@ Import Namespace="LearnAspUtilityBelt"%>
<%@ Assembly src="utilitybelt.vb" %>
<script language="VB" runat="server">
    dim ub1 as new learnasp.utilitybelt()
    dim strConnect as string
Sub Page_Load(S As Object, E As EventArgs)
    ub1.Options("Debug-On,Advice-Off,Trace-Off,Xray-To-Page-On")
    
    strConnect="\experiments\data\biblio.mdb"
    
    ub1.Options("Xray-On")    
    
    SuperTrace.Write("x",7)
    
    dim dtNYFolks as new datatable
    ub1.DBPopulate(strConnect,"select * from publishers where state='NY'",dtNYFolks)
    ub1.Xray(dtNYfolks,"dtNYfolks")
    
    dim dtCAFolks as new datatable
    ub1.DBPopulate(strConnect,"select * from publishers where state='CA'",dtCAFolks)
    ub1.Xray(dtCAFolks,"dtCAfolks")

    dim hashTest as new hashtable
    hashtest.add("fname","Hitoshi")
    hashtest.add("lname","Carroll")
    hashtest.add("bday","6/16/1998")
    ub1.Xray(hashtest,"hashTest")

    ' Array List 
    DIM alPeople as new arraylist()
    alPeople.Add ("Michi")
    alPeople.Add ("Robie")
    alPeople.Add ("Hitoshi")
    ub1.Xray(alPeople,"alPeople")

    ' Sorted List
    DIM slpeople as new sortedlist()    
    with slPeople
        .Add ("Robie",12)
        .Add ("Michi",2)
        .Add ("Hitoshi",4)
    end with
    ub1.Xray(slPeople,"slPeople")
    
    ' Queues
    DIM qTest as new Queue
    with qtest
        .enqueue (100)
        .enqueue (200)
        .enqueue (300)
    end with
    ub1.Xray(Qtest,"Qtest")
    
    ' Stack
    DIM stkTemp as new stack
    with stkTemp
        .Push("PacMan")
        .Push("Ms. PacMan")
        .Push("PacMan Jr.")
        .Push("GrandPa PacMan")
    end with
    ub1.Xray(stkTemp,"stkTemp")
    
    
    ub1.XRay("/experiments/data/animalslippers.xml","Slippers")


    ub1.Options("Xray-Off")
    
    dim arryCities as array
    ub1.DBPopulate(strConnect,"select distinct city from publishers",arryCities)
    ub1.Xray(arrycities,"arryCities")
    
    ub1.Array1dRandomize(arryCities,2)
    ub1.Log("SUB Page_Load", "now we re-arranged the array")
    ub1.Xray(arrycities,"arryCities")
    
    'dim arryNY() as string
    dim arryNY as array
    ub1.DBPopulate(strConnect,"select * from publishers where state='NY'",arryNY)
    ub1.Xray(arryNY,"arryNY")

    ub1.Options("Xray-On")
    
    dim dsSlippers as dataset
    dsSlippers=ub1.XMLTodataset("/experiments/data/animalslippers.xml")
    ub1.Xray(dsSlippers,"dsSlippers")
    
End Sub

</script>
<html><head>
<title>Xray Utility Belt Demo</title>
</head>
<body bgcolor="#FFFFFF">
<form runat="server">
<asp:placeholder id="plcDiagnostics" runat="server"/>
<asp:placeholder id="plcErr" runat="server"/>
</form>
</body></html>
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.