CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

John Papa [MVP C#]

.NET Code Samples, Data Access, and Other Musings

June 2005 - Posts

  • ADO.NET 2 Presentation - June 29th

    I’ll be at VSLive in Boston at the end of this month demonstrating coding techniques with ADO.NET 2, so please drop by and say hi if you get a chance. The session is titled Get Ready for ADO.NET 2 and is at 5:45pm on June 29th. Below is the synopsis of the session … and the agenda from my slide deck:

     

    Get Ready for ADO.NET 2

    Data access using ADO.NET is at the core of most .NET enterprise applications. While ADO.NET 1.x is powerful, its successor ADO.NET 2 contains several new features that are can benefit an application. We'll review these new features and how to take advantage of them including binary serialization of DataSets, multiple active resultsets (MARS), and enhancements to strongly typed DataSets.

     

    Agenda:

    • Enhancements/Refinements, not a revolution
    • DataTable Enhancements
    • DataTableReader
    • Loading Data
    • LoadOption enumerator
    • Changing RowState
    • AcceptChangesOnUpdate
    • DataView enhancements
    • Batch Updates
    • Faster loading
    • Binary Serialization
    • Asynchronous commands
  • Talking about Transactions - June 30th

    I’ve been getting my slides and code samples together over the past few weeks for the upcoming conferences. The next one I’ll be at is at the end of this month in Boston at VSLive talking about transactions. The session is titled Lightweight Promotable Transactions using System Transactions and ADO.NET 2 and is at 2pm on June 30th. Below is the synopsis of the session and the agenda from my slide deck … please drop by and say hi if you are attending.

     

    Lightweight Promotable Transactions using System Transactions and ADO.NET 2

    The.NET Framework v2 includes the System.Transactions namespace that enhances transactional support for managed code. We'll discuss how System.Transactions can handle transactions without using other common practices such as deriving from a ServicedComponent, using interception, or using reflection. Designed to integrate with SQL Server 2005, System.Transactions supports the intelligent and automatic promotion of local lightweight transactions to fully distributed transactions. It also introduces a new class called LightweightTransactionManager, which is a faster alternative to using the DTC for local transactions. We'll walk through examples that modify the default transactional settings of the implicit local transaction and modify the isolation level, timeout period, and transaction's context, and more.

     

    Agenda:

    • Transactional Support
    • Why use System.Transactions
    • Resource Managers
    • Ambient Transactions
    • Lightweight Transaction Manager (LTM)
    • Lightweight Transactions
      • Promoting them
      • How and when (and when not)
    • Implicit Transactions
      • Implicit because of default connection string setting of enlist=true
      • TransactionScope object with default settings
      • Isolation Level, Timeout Period, Transaction Context
    • Explicit Transactions
      • Enlisting in a transaction
    • New Interfaces

     

     

  • Follow up on iPod Armband and Headphones

    As I posted last week, I got up a new iPod mini for running and light soccer drills. It was a very nice birthday / father’s day gift from my family.

    I bought myself some of the Etymotic Research ER6i Isolator Earphones that Sahil and Brendan both recommended. They are excellent and quite comfortable. I don’t push them all the way in when I run though as I fear getting nailed by a car, bike or some other vehicle ;-) I have been very impressed so far with the headphones. If you pick some up, defiantely shop around. As I mentioned previously, I found these for $81 online. Several places had them for $93 all the way up to $149. The music does seem to sound a bit “tinny” to me in the headphones, but I am not all that sure I have found the right settings yet for the iPod. So it might just be user error on my part. I just don’t know yet.

    I ended up getting the DLO Action Jacket mini armband for the iPod mini. It isn;t completely sealed as a few areas would let water in. So I would not take it out in a steady rainfall.  But the armband is comfortable and secure. The armband stayed on quite well through heavy running. I hid the wire inside the velcro strap attachments, so I didn’t miss not having a wire strap either.

    I tried the Apple armband on at a local store and it just felt like garbage. The XtremeMax SportWrap iPod mini armband  is an excellent choice as it is even more impervious to water than the DLO armband. However, I did not like how big the armband waswhen I tried it on. It seemed to consume my entire arm. Not being built like Arnold, it just didnt fit well on me. But if you are bigger than me (and most people are) it might work well for you.

  • Enterprise Library Data Access Application Block, Part 1

    The July 2005 issue of MSDN Magazine is now available online. The amount of discussion that has surrounded the Enterprise Library and its Application Blocks (good, bad and indifferent) has been tremendous. I decided to create a 3 part series that explores the Enterprise Library Data Access blocks in my Data Points column. In this issue I discuss how how the Enterprise Library DAAB fits into an architecture as well as some best practices in using the block. I review the Enterprise Library model and dive right into the DAAB and its configuration and cryptography features, when and where the DAAB can be used, and lots more.

    There is a lot to review with Ent Lib and onyl so much fits into an article, so I decided to split this up into a 3 parter. In the upcoming Part 2 and Part 3 I explore how post build events can be used to ease the use of configuration files, several ways of retreiving data, saving data, transactions with Ent Lib, using NUnit with Ent Lib, and its factory model.

     

  • Good iPod Armband and Headphones

    As I posted last week, I got up a new iPod mini for running and light soccer drills. It was a very nice birthday / father’s day gift from my family.

    I bought myself some of the Etymotic Research ER6i Isolator Earphones that Sahil and Brendan both recommended. They are excellent and quite comfortable. I don’t push them all the way in when I run though as I fear getting nailed by a car, bike or some other vehicle ;-) I have been very impressed so far with the headphones. If you pick some up, defiantely shop around. As I mentioned previously, I found these for $81 online. Several places had them for $93 all the way up to $149. The music does seem to sound a bit “tinny” to me in the headphones, but I am not all that sure I have found the right settings yet for the iPod. So it might just be user error on my part. I just don’t know yet.

    I ended up getting the DLO Action Jacket mini armband for the iPod mini. It isn;t completely sealed as a few areas would let water in. So I would not take it out in a steady rainfall.  But the armband is comfortable and secure. The armband stayed on quite well through heavy running. I hid the wire inside the velcro strap attachments, so I didn’t miss not having a wire strap either.

    I tried the Apple armband on at a local store and it just felt like garbage. The XtremeMax SportWrap iPod mini armband  is an excellent choice as it is even more impervious to water than the DLO armband. However, I did not like how big the armband waswhen I tried it on. It seemed to consume my entire arm. Not being built like Arnold, it just didnt fit well on me. But if you are bigger than me (and most people are) it might work well for you.

     

  • The Finalizer's New Web Site

    The Finalizer was revealed today at Tech Ed. You can check out this BattleBot that runs on .NET code at the new web site. New content is still being added including videos and an official case study.

  • Visual Studio 2005 to be Launched week of November 7, 2005

    At today's Tech-Ed keynote address in Orlando, Microsoft Vice President Paul Flessner announced that Visual Studio.NET 2005 will "launch internationally the week of November 7th". He also stated that SQL Server 2005 and BizTalk 2006 will be launched that week, too.

     

    I imagine the official launch site will be updated soon, too.

     

    Whidbey has been nailed to a date. Orcas is next!

    Posted Jun 07 2005, 11:59 AM by John Papa with 2 comment(s)
    Filed under:
  • Find a Column, Find a Table in SQL Server

    OK, so this isn’t rocket science, but then again some of the best things are the simplest. You can do a lot with the information_schema views in SQL Server.

    Here is a short stored procedure that you can use to find:

    • a table by its full name
    • a table by partial name
    • a column by its full name
    • a column by its partial name

     It comes in handy for me when I am looking for a field in related tables, or a spec I am reading refers to a field by name but not by the table it is in. Like I said, it is simple, but I have used this type of a proc for a long time.

    Table or Column Finder
    
    CREATE PROCEDURE prFindTableOrColumn
    (
    	@table_name VARCHAR(128) = NULL,
    	@search_data VARCHAR(128) = NULL
    )
    AS
    	
    	DECLARE @search1 VARCHAR(128)
    	SET @search1 = '%' + @table_name + '%'
    	IF @search1 IS NULL
    		SET @search1 = '%'
    	
    	DECLARE @search2 VARCHAR(128)
    	SET @search2 = '%' + @search_data + '%'
    	IF @search2 IS NULL
    		SET @search2 = '%'
    	
    	SELECT
    		c.table_name,
    		c.column_name,
    		c.data_type,
    		c.character_maximum_length,
    		c.numeric_precision,
    		c.numeric_scale
    	FROM	
    		information_schema.columns c
    		INNER JOIN information_schema.tables t 
    			ON c.table_name = t.table_name 
    	WHERE
    		c.table_name LIKE @search1
    		AND c.column_name LIKE @search2
    		AND t.table_type = 'BASE TABLE'
    	ORDER BY 
    		c.table_name,
    		c.column_name
    

    Posted Jun 06 2005, 04:33 PM by John Papa with 13 comment(s)
    Filed under:
More Posts