The new Windows Forms data binding features coming in .NET 2.0 and Visual Studio 2005 are very exciting. If you are a fan of the DataSet, the new smart DataTable objects will provide you with a way to encapsulate your business logic and data in a single object. If you prefer the object-oriented approach, as I do, then the new RAD support for objects will be very compelling. Personally I can't wait until I'm able to start building forms by simply using drag-and-drop to get my business objects onto a form!
About the Author
Rockford Lhotka is the author of numerous books, including the Expert One-on-One Visual Basic .NET & C# Business Objects books. He is a Microsoft Software Legend, Regional Director, MVP and INETA speaker. Rockford speaks at many conferences and user groups around the world and is a columnist for MSDN Online. Rockford is the Principal Technology Evangelist for Magenic Technologies, one of the nation's premiere Microsoft Gold Certified Partners dedicated to solving today's most challenging business problems using 100% Microsoft tools and technology.
Listing 1. Product class implementing IEditableObject
Imports System.ComponentModel
Public Class Product
Implements IPropertyChange
Implements IEditableObject
Public Event PropertyChanged(ByVal sender As Object, _
ByVal e As PropertyChangedEventArgs) _
Implements IPropertyChange.PropertyChanged
Private mName As String = ""
Private mPrice As Single
Private Sub New()
' require use of factory method
End Sub
Public Shared Function NewProduct( _
ByVal name As String, ByVal price As Single) As Product
Dim prod As New Product
prod.mNew = True
prod.Name = name
prod.Price = price
Return prod
End Function
Public Shared Function GetProduct( _
ByVal name As String, ByVal price As Single) As Product
Dim prod As New Product
prod.mNew = False
prod.Name = name
prod.Price = price
Return prod
End Function
Public Property Name() As String
Get
Return mName
End Get
Set(ByVal value As String)
mName = value
RaiseEvent PropertyChanged( _
Me, New PropertyChangedEventArgs("Name"))
End Set
End Property
Public Property Price() As Single
Get
Return mPrice
End Get
Set(ByVal value As Single)
mPrice = value
RaiseEvent PropertyChanged( _
Me, New PropertyChangedEventArgs("Price"))
End Set
End Property
#Region " IEditableObject "
Private mOldName As String
Private mOldPrice As Single
Private mEditing As Boolean
Private mParent As ProductList
Private mNew As Boolean
Friend Sub SetParent(ByVal parent As ProductList)
mParent = parent
End Sub
Public Sub BeginEdit() _
Implements System.ComponentModel.IEditableObject.BeginEdit
If Not mEditing Then
mOldName = mName
mOldPrice = mPrice
mEditing = True
End If
End Sub
Public Sub CancelEdit() _
Implements System.ComponentModel.IEditableObject.CancelEdit
If mNew Then
mParent.Remove(Me)
Else
mName = mOldName
mPrice = mOldPrice
End If
mEditing = False
End Sub
Public Sub EndEdit() _
Implements System.ComponentModel.IEditableObject.EndEdit
mEditing = False
mNew = False
End Sub
#End Region
End Class
Listing 2. ProductList class supporting IEditableObject in Product
Imports System.ComponentModel.Collections.Generic
Public Class ProductList
Inherits BindingList(Of Product)
Protected Overrides Function AddNewCore() As Object
Dim prod As Product = Product.NewProduct("", 0)
prod.SetParent(Me)
Add(prod)
Return prod
End Function
End Class
Proposion N2N connects Microsoft .NET applications to Lotus Notes and Lotus Domino databases. This ADO.NET managed data provider allows you to perform blindingly fast queries and updates of Notes data from ASP.NET pages, .NET web services, Windows, or Mobile applications. An innovative SQL-like query language leverages the unique features of Notes and makes collaborative software accessible to relational database programmers.
Unlike text-based file formats image files aren't made up of words, which makes searching for an image file by keyword difficult. Instead of being able to simply open the file to see what it contains, we're stuck looking at the text around it and other metadata to determine the image's meaning. In this article, Ziran Sun shows you how to build a simple database-based image keyword system that allows you to associate keywords with images and use these keywords to make finding images easier. [Read This Article][Top]
In the second part of of his article on using MySQL with ASP.NET, Ziran Sun covers how to add a new MySQL user to the database server, assign the user the appropriate permissions, connect to the database, and build a simple ASP.NET page to perform a query. [Read This Article][Top]
Back in the days of classic ASP, if you were building a database-driven
web site, your choice was either to invest a lot of money to get a copy of Microsoft SQL Server
(or some other enterprise-ready database) or invest a lot of time finding a way to deal with the
performance and scalability limitations of Microsoft Access. Luckily these days there's
another viable alternative: MySQL. [Read This Article][Top]
Moving or copying a SQL Server database from one machine to another requires a lot of preparation in order to ensure a smooth transfer. In this article, Dina Fleet Berry examines the different methods and highlights the different issues associated with each of them. [Read This Article][Top]
There are many times when using SQL Server 2000 Query Analyzer to debug SQL statements is a better choice than debugging in Visual Studio .NET. In this article, Dina Fleet Berry explains why and walks you through the debugging process step-by step. [Read This Article][Top]
As a follow up to his article on retrieving objects from SQL Server using SQLXML and serialization, Gianluca Nuzzo discusses saving objects back to SQL Server using a schema definition file and updategrams. [Read This Article][Top]
One area that stands out when comparing ADO.NET 1.x to ADO.NET 2.0 is transaction processing. Bill Ryan shows just how easy transaction processing has become with the TransactionScope object in ADO.NET 2.0. [Read This Article][Top]
Developers often use brute force coding to marshal data between the GUI and application objects. In this article, Luther Stanton explains how to use .NET's out-of-the box data-binding functionality to make this job much easier. [Read This Article][Top]
Learn how to create a console application to queue a message in Microsoft Message Queuing (MSMQ) and then use an extended stored procedure to call the console application from a SQL Server trigger. [Read This Article][Top]
Connection pooling increases the performance of Web applications by reusing active database connections instead of creating a new connection with every request. This article shows how to monitor the connection pool, diagnose a potential problem, and apply the appropriate fix. [Read This Article][Top]
Mailing List
Want to receive email when the next article is published? Just Click Here to sign up.