Chuck Bryan

The second you stop fighting it, time really is on your side.

<December 2008>
SuMoTuWeThFrSa
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910


Navigation

Books

Subscriptions



Sunday, August 15, 2004 - Posts

Declarative Programming in ASP.NET 2.0

So, how easy is 2 tier development in ASP.NET. Pretty Simple:

<HTML>
<BODY>
<B>ASP.NET 2.0</B><br>
A Test page for some of the ASP.NET 2.0 Features<br>
<form runat="server">

<asp:SqlDataSource  id="ds1" runat="server"
 ConnectionString="server=localhost;database=Northwind;uid=sa;pwd="
 SelectCommand="Select ProductId, ProductName, QuantityPerUnit, UnitPrice,    UnitsInStock, Discontinued From Products"
/>

<asp:GridView id="grid1" DataSourceId="ds1" runat="server" />
</form>
</BODY>
</HTML>

So, what do we have here? One of the goals of ASP.NET 2.0 is to continue to decrease the amount of code the developer has to write. To that end, more programming can be done declaratively. I honestly do not know what that means, but, from the context of the word, it appears that there are more controls that you can put on a page and set a series of properties.

Take for instance the new Data Source Controls. This example uses the SqlDataSource, which can be used to connect to a SQL server. All you have to do is provide a connection string and a select statement and the control will create your command, connection, data adapter and even fill a dataset for you. There are many more attributes that you can specify, including Insert, Update and Delete statements.

BTW, went back to B&N and bought ASP.NET v2.0 The Beta Version by Homer, Sussman and Howard. If you are playing with the betas, this is an invaluable “field guide!”

C

posted Sunday, August 15, 2004 4:58 PM by c2bryan with 3 Comments




Powered by Dot Net Junkies, by Telligent Systems