Initialization Code

Team-Fly team-fly    

 
ADO.NET Programming in Visual Basic .NET
By Steve  Holzner, Bob  Howell

Table of Contents
Chapter 11.   Creating Your Own Data Control


Before we continue, let's finish the initialization code. Go back to the constructor. After the code we added to wire the events, let's add this code:

 mSQLBuilder = New SqlClient.SqlCommandBuilder(mAdapter)  mAdapter.SelectCommand = New SqlClient.SqlCommand("", mConnection)  mAdapter.InsertCommand = New SqlClient.SqlCommand("", mConnection)  mAdapter.DeleteCommand = New SqlClient.SqlCommand("", mConnection)  mAdapter.UpdateCommand = New SqlClient.SqlCommand("", mConnection)  mDataSet.Tables.Add() 

These initializers just precreate the objects mentioned so they show up in the Property window correctly. Before the region add the following declarations. The region statement is shown for a point of reference:

 Private mSQLBuilder As SqlClient.SqlCommandBuilder      Private mstrConn As String      Private mintBoundTable As Integer = 0      Private mblnAutoText As Boolean      Public Event BoundTableChanged(ByVal intBoundTable As Integer)      Public Event DataSetFilled(ByVal dsDataSet As DataSet)      Public Event PositionChanged(ByVal intNewRow As Integer)  #Region " Windows Form Designer generated code " 

Don't worry about what these are for yet, especially the SqlCommandBuilder object. We will discover what they do shortly.


Team-Fly team-fly    
Top


ADO. NET Programming in Visual Basic. NET
ADO.NET Programming in Visual Basic .NET (2nd Edition)
ISBN: 0131018817
EAN: 2147483647
Year: 2005
Pages: 123

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net