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>
[prev. Lesson]  Utility Belt - FREE Reusable Library
     [next Lesson]  Documentation

Utility Belt - Introduction
   Design and most coding by Charles Carroll
    and the UtilityBelt Coding team

1 Library file to cut and paste @  (that's right 1!)
   http://www.learnasp.com/freebook/learn/utilitybelt_lib.aspx

Code Reuse is VERY IMPORTANT, yet my experience is that most beginning programmers don't re-use code in their first 6 months of coding.  This UTILITY BELT library is designed so that brand new programmers can use it easily. A lot of thought went into making the library easy to call without having to learn any kind of sequencing of inter-related calls. We wanted to get beginning coders started reusing code immediately when learning ASP.net, so we invented the Utility Belt library with several compelling reasons they must use it!

  • Reduce lines of code 70% in most cases. Make powerful apps with little code.

  • Faster applications because caching is easy and transparent all Utility Belt commands that fetch data from the database support caching by setting 1 property instead of changing the 10s of query calls in your programs.

  • Superb error trapping to avoid orphaned resources, provide maximum debugging in time of crisis, and to email and/or log runtime errors so you know about them all not just the ones the users report.

Free Email Tech Support
Utility Belt Help, Preview New Versions
http://groups.yahoo.com/group/AspNetUtilityBelt

The Utility Belt Way To Fill Grid (3 lines or less)
Dim strConn as string="whatever.mdb"
Dim strSQL as string="select * from publishers where state='NY'"
ub1.DbPopulate(strConn,strSQL,MyDataGrid)

The Way Most People Code (10 lines)

Dim DS As DataSet
Dim MyConnection As OLEDBConnection
Dim MyCommand As OLEDBDataAdapter

MyConnection = New OLEDBConnection("....")
MyCommand = New OLEDBDataAdapter("select * from publishers where state='NY'", MyConnection)

DS = new DataSet()
MyCommand.Fill(ds, "NYStateOfMind")

MyDataGrid.DataSource=ds.Tables("Authors").DefaultView
MyDataGrid.DataBind()
MYConnection.Close()

The Correct Way They Should Have Coded It! (26 lines)

Dim Conn as  OLEDBConnection
Dim Cmd as  OLEDBCommand
Dim Rdr as OLEDBDataReader
TRY
   Dim strConn as string
   strConn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE="
   strConn &= server.mappath("whatever.mdb")
   Dim strSQL as string
   strSQL="select * from publishers where state='NY'"
   Conn=New OLEDBConnection(strConn)
   Cmd=New OLEDBCommand(strSQL,Conn)
   Conn.Open()
   Rdr=Cmd.ExecuteReader()
   myDataGrid.DataSource = Rdr
   myDataGrid.DataBind()
CATCH ex1 as exception
    page.Add.controls(new literalcontrol(exc1.message)
FINALLY
    IF Not(rdr is nothing)
        If Rdr.IsOpen THEN rdr.close()
    END IF
    IF Not(rdr is nothing)
        If Rdr.IsOpen THEN rdr.close()
    END IF
END TRY

 

What can Utility Belt do?

  • Read databases queries with 1 call - pour into controls, arrays or datatables.

  • Switch between Access and SQLserver without changing code. All database calls are not separate. It analyzes connection strings and uses correct one under cover.

  • Cache your databases queries or Web Pages with 1 line addition to code! No changes to the hundreds of queries in your program required even if you want to cache them all.

  • Email enable your application yet eliminate the most frequent parameter mistakes.

  • High Speed Email mode with only 1 property set. drops off files into mail pickup directory and avoids SMTP entirely.

  • Grab web Pages with 1 call cache them to make it 150 x faster.

  • Fetch product details from Amazon.

  • Simplify debugging by Xrays of datatables, hashtables, every SQLcommand used, et al. 100 x more powerful than trace.warn and trace.write. Plus unlike trace you will never have to comment them out; they can be turned off in groups easy.

  • Make your complex websites flow more like a book with book style "table of contents" and Prev/next page widgets.

Demos of Utility Belt - great samples to Steal
http://www.learnasp.com/freebook/learn/?caller=utilitybelt&section=Utility+Belt+-+Demos

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.