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: DataBinding to DataView Sample Code
by Charles Carroll

The code below shows "Utility Belt" simplifying the lines of code to DataBind a control to a DataView.

Here is the way to bind a control with UtilityBelt. Note that strConnect can be a filename (in the case of Access, Excel or any file based database), a Key Name from Web.Config or any other legit connect string.

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

<Test Script Below>


<%@ debug="true" %>
<%@ Assembly src="utilitybelt.vb" %>
<script language="VB" runat="server">
    dim ub1 as new LearnAsp.utilitybelt()
    dim strConnect as string="\experiments\data\biblio.mdb"
    dim strSQL as string
sub Page_Load(S As Object, E As EventArgs)
    ub1.Options("Debug=on,Advice=off,Hints=off")
    strSQL="select * from publishers where state='NY'"

    Dim dv1 As new system.data.DataView
    ub1.DBPopulate(strConnect,strSQL,dv1)
    dv1.Sort = "Address"
    dv1.RowFilter = "City='Albany'"
    ub1.DBPopulate(dv1,grdSample)
End Sub
</script>
<html><head>
<title>Utility Belt Demo</title></head>
<body bgcolor="#FFFFFF"><form runat="server">
<asp:datagrid id="grdSample" EnableviewState="false" 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.