Varad, The .NET Guy!

Exploring the excitement of Microsoft .NET and much more..

July 2004 - Posts

New data source components in ASP.NET 2.0

http://msdn.microsoft.com/data/archive/default.aspx?pull=/msdnmag/issues/04/06/aspnet20data/default.aspx 

This article discusses on the following:
 
New data source components in ASP.NET 2.0
Binding to business objects and XML data
GridView and DetailsView controls
 
Summary:
Data source controls make codeless binding possible, but seldom practical in real-world situations. Some code must always be written to fine tune the page, but data source controls significantly reduce the quantity. Data source controls also integrate caching capabilities and allow you to enable caching declaratively. Everything happens behind the scenes so you can deliver best-practice code with almost no effort.
 
Data source controls enable a consistent model across a variety of data sources. You can use the same data-binding model regardless of whether the data source is a SQL table, an XML document, a business object, a site map, or even an Excel worksheet. The new architecture is more automatic in nature, but works side-by-side with the old model based on enumerable objects.
 
Posted: Jul 31 2004, 05:20 PM by Varad | with 1 comment(s)
Filed under:
SQL Server 2000 - XML UpdateGrams

We have implemented the feature of XML Updategrams in one of our recent projects, I was very much attracted by the ease coding and performance provided by this new feature in SQL 2000. Now this is the time where many are talking about SQL Server Express and Yukon, But I think this might be useful to many developing for SQL 2000.

 

What are Updategrams?

In essence, Updategrams are a new feature of SQL Server 2000 that allow SQL Server database updates to be defined as XML.  This is ultimately achieved by mapping the XML nodes against corresponding database columns.

Updategrams can be used to replace existing data access components in a middle tier. A typical Windows NT DNA application will include a middle tier consisting of Business Logic and Data Access code. The Data Access code will interface with the database using disconnected Recordsets and Command objects calling SQL Server stored procedures etc. Most of the Data Access section of your middle tier can be replaced with Updategrams.

 

What are the benefits?

Most Data Access tiers (both middle tier code and stored procedures) will individually deal with specific database tables or groups of related tables. This can inhibit performance and quite often several round trips to the database are required to complete a transaction.

Updategrams can solve this problem by including all of your data in an XML document, which is then mapped to database tables and columns. The entire database update can then be accomplished in one foul swoop. This update can include inserting, updating and deleting data.

 

How do Updategrams work?

An Updategram consists of data which is mapped to corresponding tables and columns in the database and transaction instructions which are defined as <updg:before> and <updg:after> XML nodes.  To update the database, both <updg:before> and <updg:after> information is supplied.  To Insert new data, just <updg:after> data is supplied and to delete data, just <updg:before> data is supplied.  The whole database update is embedded within an <updg:sync> node which acts as the transaction.  <updg:sync> works in a similar way to BEGIN TRAN and COMMIT TRAN in Transact-SQL. When perfoming Updates and Deletes, affected records are identified by the data contained within the <updg:before>.

 

Learn more about Updategrams at

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sqlxml3/htm/updategram_375f.asp

 

http://www.winnetmag.com/SQLServer/Article/ArticleID/16135/16135.html

 

http://www.topxml.com/sql/updategrams.asp

 

 

 

The TextChanged event of a TextBox control may not fire...

When you enable the AutoComplete feature of forms in Microsoft Internet Explorer and then you select any text from the AutoComplete drop-down list of a TextBox control in a Web application, the TextChanged event of the TextBox control does not fire even though the text in the TextBox control changes.

To work around this behavior, disable the AutoComplete feature of the Web form. To do this, follow these steps:

  1. In Solution Explorer, right-click WebForm1.aspx, and then click View Designer.
  2. Switch to the HTML view of WebForm1.aspx.
  3. Locate the following code:
    <form id="Form1" method="post" runat="server">
  4. Replace the code that you located in step 3 with the following code:
    <form id="Form1" method="post" runat="server" autocomplete="off">
For more information read Microsoft Knowledge Base Article - 873198
.....
Posted: Jul 24 2004, 05:52 PM by Varad | with no comments
Filed under:
Using Nested Structs..

There was a question asked by one of a group member “Is it possible to use nested structs in .NET?” in the group meeting, we had a long discussion and started trying out with some code. We found out that it is possible to have nested structs in .NET and the following code illustrates the solution:

We can declare nested structs i.e structs inside other structs.

public class Class1

{

static void Main ( string[ ] args )

{

myoutter o ;

o.a = 10 ;

myoutter.myinner I ;

i.x = 20 ;

Console.WriteLine ( "{0} {1} ",o.a, i.x ) ;

}

}

public struct myoutter

{

public int a ;

public struct myinner

{

public int x ;

}

}

Output: 10 20

It is possible to nest references to structs, and we can use dot notation to access all levels with nested structures.

Example:

public class Class1

{

static void Main ( string [ ] args )

{

myoutter o ;

o.a = 10 ;

o.i.x = 20 ;

myinner i ;

i.x = 30 ;

Console.WriteLine ( "{0} {1} {2}", o.a, o.i.x, i.x ) ;

}

}

public struct myoutter

{

public int a ;

public myinner i ;

}

public struct myinner

{

public int x ;

}

Output : 10 20 30

 

MSDN Mag 04/08 | Bulletin Board

Wow! It amazing. Nice to see the new column Bulletin Board in MSDN Magazine August Issue. This would be very useful to developers like me. It's worth for reference.

Read more on Bulletin Board @ http://msdn.microsoft.com/msdnmag/issues/04/08/BulletinBoard/default.aspx

...

YUKON - Microsoft SQL Server 2005!

Yesterday I had a nice time of 2 to 3 Hrs by going thru the new features and advantages of the Microsoft SQL Server 2005 (Code Named "YUKON"). Microsoft says that the next release of SQL Server will be a new paradigm for database development. This version of SQL Server is integrated with .NET Framework which will enable database programmers to take full advantage of .Net Base Class Libraries. Using the CLR integration, many tasks that were difficult to perform in T-SQL can be better accomplished using managed code plus two news types of database objects aggregates and user defined types that are introduced in this version.

More product details and features of MS SQL Server 2005
here

For new development features read on Overview of SQL Server YUKON

What are the major benefits for developers like me??

The integration of CLR with SQL Server provides several major benefits to database developers:

Enhanced programming model: The .NET languages are in many respects richer than Transact-SQL (T-SQL), offering constructs and capabilities previously not available to SQL developers.

Enhanced safety and security: Managed code runs in a common language run-time environment, hosted by the database engine. This allows .NET database objects to be safer and more secure than the extended stored procedures available in earlier versions of SQL Server.

User defined types and aggregates: Two new database objects which expand the SQL Server's storage and querying capabilities are enabled by the hosting the CLR.

Common development environment: Database development is integrated into future releases of the Microsoft Visual Studio .NET development environment. Developers use the same tools for developing and debugging database objects and scripts as they use to write middle-tier or client-tier .NET components and services.
I expect that in the final version of SQL Server Yukon, an updated version of Visual Studio.NET will include special SQL Server projects containing the appropriate references that can load into the Visual Studio .NET IDE.

Performance and scalability: Because managed code compiles to native code prior to execution, you can achieve significant performance increases in some scenarios.

The following are some experts on SQL Server YUKON:

Transact-SQL is no longer be required to write SQL Server stored procedures, triggers, and user-defined functions. You'll be able to create these objects using any of the .NET languages -- VB.NET, C#, C++, or even COBOL.NET -- and compile them into .NET assemblies.

One important benefit of relying on the .NET Common Language Runtime is that it can verify that all code hosted by SQL Server won't cause any memory usage errors that would bring down the server. In addition, SQL Server will benefit from the CLR's robust support for versioning and security.

Data access in Yukon will be based on a new set of managed interfaces in ADO.NET. This new set of ADO.NET classes will be grouped within a namespace that is currently being called System.Data.SqlServer, and these classes will interact directly with SQL Server's internal query processing mechanisms.

SQL Server will also leverage the Common Language Runtime's code access security model. By default, code doesn't have any permissions to create a graphical user interface, create threads, access the file system, or call unmanaged code. The only permissions implemented are those granted for in-process SQL Server data access.

Altering assemblies will not be allowed to invalidate persistent data or indexes. For example, suppose you have an indexed, computed column that relies on a .NET function to perform the computation. Changing or dropping this function would invalidate any data stored in that index. Dependencies are tracked, and you can't drop an assembly if dependencies exist.

In Yukon, you can encapsulate your middle-tier logic within server-side components and still have all the advantages of running as compiled machine code, not interpreted Transact-SQL. This won't make much of a difference for code that's primarily performing data access; the goal for Microsoft is that CLR data access code will execute as fast as the equivalent code written in Transact-SQL.

Relying on .NET code won't hamper the scalability of your SQL Server database operations. Yukon's ability to handle a given number of concurrent users with a given set of hardware resources will be as good as (or better) than that of SQL Server 2000.

A new developer tool called the SQL Server Workbench will support deployment of assemblies to multiple servers and will contain a powerful subset of Visual Studio.NET capabilities for code management. It's too early to tell what the SQL Server Workbench will actually look like, but it will most likely resemble the user interface currently available in Visual Studio.NET.

Learn more on YUKON's XML Support Features
Goodbye to Middle-Tier Logic

There are lot more features and advantages for YUKON, I need to dig more on net for YUKON...

Exceptions and Assertions (re-post)

This is a re-post of Ohad Israeli's one, I found this very useful and included here for my reference.

Many Thanks to Mark Treadwell and Ohad Israeli for sharing the info.

Mark Treadwell has a great post with lots of sources regarding exception management

 

Inside Avalon: The Avalon Control Content Model

This recent article in MSDN describes about the Control Content Model of Avalon. It explains the following two principles on control content model:

1) Smooth Progression From Simple To Rich Control Content

2) Data Is a First Class Citizen for Control Content

Read more ... http://msdn.microsoft.com/longhorn/default.aspx?pull=/library/en-us/dnavalon/html/avalon07072004.asp

........

Learn more about VWD & SSE 2005

Web Development with Visual Web Developer 2005 Express Edition and SQL Server 2005 Express Edition, Part 1

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/VWD_SSE.asp

Note:  This article is based on the May 2004 Alpha release of Visual Web Developer 2005 Express Edition and SQL Server 2005 Express Edition Technical Preview. All information contained herein is subject to change.

......

Microsoft Innovation Website!

Today I noticed a new stuff (in ad banner) at Microsoft Home Page(www.microsoft.com), a link to the Innovation Website. It was amazing experience and worth a look.

This is an invitation to visit a Microsoft innovation website at http://www.microsoft.com/mscorp/innovation/yourpotential.  At this site you can experience the empowering impact of innovation in action, discover new technologies and take a sneak peek into the future with Microsoft Research. Please follow the link above to explore a world of innovation inspired by your potential. Visiting the site via a broadband connection is highly recommended.

Please excuse me if you do not have broadband connection!!

Note: Make sure to use Head Phones and enable the sounds.

.....

More Posts Next page »