|
xxx
Utility Belt:
ExecuteScalar Demo
by Charles Carroll
The code below calls "Utility Belt"
DBpopulate SUB to do the work that ExecuteScalar in ADO.net usually does.
The DBPopulate sub is flexible
enough to invoke ExecuteScalar under the covers as this sample shows.
filename=/experiments/utilitybelt/vercurrent/ubdemo_scalar.aspx
<%@ debug="true" %>
<%@ Assembly src="utilitybelt.vb" %>
<script language="VB" runat="server">
dim ub1 as new learnasp.utilitybelt()
dim strConnect as string="LearnAspSamples"
dim strSQL as string
Sub Page_Load(S As Object, E As EventArgs)
ub1.Options("Debug-On,Advice-Off")
strConnect="LearnAspSamples"
dim intNYcount as integer
strSQL="select count(*) from publishers where state='NY'"
ub1.DBPopulate(strConnect,strSQL,intNYcount)
litOutput.text = "New York has " & intNYcount & " records"
strSQL="select name from publishers where pubid=164"
dim strCompanyName as string
ub1.DBPopulate(strConnect,strSQL,strCompanyName)
litOutput.text &= "<br>Pub_ID=164 is named: " & strCompanyName
End Sub
</script>
<html><head>
<title>UtilityBelt Demo Scalars</title></head>
<body bgcolor="#FFFFFF">
<form runat="server">
<asp:literal id="litOutput" 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.
|  |
 |  |  |
|
|
|
|