enterprise data manager in vb.net 2005

38
Table of Contents Created by ECOLOGIC CORPORATION www.ecologic.co.in : For Project Ideas [email protected] For Technical Slide Shows from Ecologic Corporation : http://www.slideshare.net/puneetarora2000/slideshows For Learning more on Java/ASP.NET /VB.NET /XML/.Web Services : http://logicatwork.info For Learning personally , Come Visit :Ecologic Corporation. Chandigarh (www.ecologic.co.in) Table of Contents Page 1 Ver 1.0.0.0 Enterprsie Data Management [email protected]

Upload: puneet-arora

Post on 12-Nov-2014

947 views

Category:

Documents


3 download

DESCRIPTION

Learn to create a Enterprise Data Management Application in VB.NET 2005,Core features of this application are a)Open any MS Access DataBase b) Add,Delete & Modify all Tables c)Do Quick Search on any Table based on many criterias

TRANSCRIPT

Page 1: Enterprise Data Manager in VB.net 2005

Table of Contents Created by ECOLOGIC CORPORATION www.ecologic.co.in : For Project Ideas [email protected]

For Technical Slide Shows from Ecologic Corporation : http://www.slideshare.net/puneetarora2000/slideshows

For Learning more on Java/ASP.NET /VB.NET /XML/.Web Services : http://logicatwork.info

For Learning personally , Come Visit :Ecologic Corporation. Chandigarh (www.ecologic.co.in)

Table of Contents Page 1

Ver 1.0.0.0

Enterprsie Data Management [email protected]

Page 2: Enterprise Data Manager in VB.net 2005

Table of Contents Created by ECOLOGIC CORPORATION www.ecologic.co.in : For Project Ideas [email protected]

For Technical Slide Shows from Ecologic Corporation : http://www.slideshare.net/puneetarora2000/slideshows

For Learning more on Java/ASP.NET /VB.NET /XML/.Web Services : http://logicatwork.info

For Learning personally , Come Visit :Ecologic Corporation. Chandigarh (www.ecologic.co.in)

Table of Contents Page 2

Copyright © 2006-2007 Jaspreet , Navneet , Harleen

1.0 Welcome to Enterprise Data Manager...........................................................4 1.1 About this Guide.............................................................................. 4 1.2 Who Should Read this Guide?........................................................ 4 2.0 About Enterprise Data Manager.....................................................................5 3.0 Getting Started with Enterprise Data Manager.............................................6 3.1 Before You Start .............................................................................. 6

3.1.1 Technical Requirements ......................................................................................................6 3.2 Accessing Enterprise Data Manager.............................................. 7

3.2.1 Enterprise Data Manager Tasks...........................................................................................9 3.2.1 How to Log Out Timeout ......................................................................................................9

3.3 Managing Your Password............................................................... 9 3.4 The User Interface ..........................................................................10 3.5 Managing Data (Adding, Deleteing , Modifying Data)...................16

3.6 Code Listing

Page 3: Enterprise Data Manager in VB.net 2005

List of Figures

List of Figures Page 3

Figure 1: The Enterprise Data Manager Log In Screen...........................................................................

Page 4: Enterprise Data Manager in VB.net 2005

Enterprise Data Manager ver 1.0.0.0

Section 1: Welcome Page 4

1.0 Welcome to Enterprise Data Manager

Thank you for evaluating Enterprise Data Manager , created by (Harleen ,Jaspreet*) . The Enterprise Data Manager edition is designed to help you enable your organization to efficiently organize and search information which is crucial to many aspects of your Data Management . One can add , modify , delete , search data based on any criteria . The Enterprise Data Manager Works with any MS Access Data base, and it automatically picks up the database schema , creates GUI for searching and manipulating data of the said tables .

1.1 About this User /Technical Guide This guide is current with the details of operation for Enterprise Data Manager. It is designed for users who are new to Enterprise Data Manager, or the areas of Enterprise Data Managerting management and desktop-based applications. The information in this guide describes how to use a personal computer and a data Brower to access Enterprise Data Manager to perform a broad range of tasks. One should be generally familiar with the use of a personal computer and desktop based softwares,

1.2 Who Should Read this Guide? This Enterprise Data Manager User Guide provides information primarily for users who want to record and track subscribers having multiple connections based on name and address ect This guide is not intended for system administration personnel who need to install and configure the system as part of its initial implementation.

Page 5: Enterprise Data Manager in VB.net 2005

Enterprise Data Manager ver 1.0.0.0

Section 2: About CRM Page 5

2.0 About Enterprise Data Manager

Enterprise Data Manager enables companies to efficiently organize, populate, and maintain tracking of information on the aspects of identifying important aspects of data . The system seamlessly blends all of the functionality required to manage information for tracking on many aspects of fraud detection and is friendly tabbed user interface. The core features of Enterprise Data Manager include:

• Works with any MS Access Data Base • It can be use by Multiple users • It is made in VB.NET Framework • View Tables in the Database • View Table Data • Search Table Data • Browse Table Data

• Add New Data to the Table

• Delete Data from Table

• Modify Data

• Update Data

• Run SQL Select Queries

Enterprise Data Manager is built on established technologies and widely supported industry standards, including the .NET development environment, the MS Acess, and works with Windows Server operating systems.

Page 6: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 6

3.0 Getting Started with Enterprise

Data Manager

3.1 Before You Start This guide assumes that the resources you need to access the system are available and that you are familiar with how to use them. If you are not sure whether your system meets the requirements or how to use required third-party tools, such as a Desktop applications .

3.1.1 Technical Requirements Before you begin using the system, ensure that you have the required software installed and configured on your system. You will require the following:

• .NET Framework 2.0 must be installed

• 512 RAM

100 MB of Space for installation .

For Development Environment MS Office and Visual Studio must be installed .

Page 7: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 7

Enterprise Data Browser and Window Controls

Enterprise Data Manager dynamically creates the windows screens displayed by the Data browser when you click certain buttons in the Application Enterprise Data Manager is designed for a minimum 1024x768-pixel screen display resolution.

Log In Information

Your system administrator assigns log in information – a user name and password – to every system user. If you have not received your user name and password combination, contact your system administrator. If you do not provide the correct user name and password, Enterprise Data Manager does not allow you access to the system.

3.2 Accessing Enterprise Data Manager To access Enterprise Data Manager Click Short on Desktop in your PC .

Page 8: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 8

Figure 1: The Enterprise Data Manager Log In Screen This is the ENTERPRISE DATA MANAGER log in screen. If you do not see a log in screen, verify that you have clicked the Application Short cut correctly, or contact your system administrator to verify that you have the correct Shortcut To proceed, you must log in to the system by providing a valid user name and password.

Logging in to the System

To log in to the system:

1. In the Enterprise Data Manager log in screen, type your user name in the User Name box.

2. Type your password in the Password box.

3. Click the Submit In button.

If you cannot log in, check the following:

• Verify that your user name and password were typed correctly, including any capital letters.

• Contact your system administrator to verify that you have the correct user name and password combination.

• Your account may have been disabled. Contact your system

Tip

Page 9: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 9

administrator or You may be trying to access to the Enterprise Data Manager from

Non –permissible IP. Welcome Screen : as shown below will reflect your Name and Your role :

3.2.1 Security Timeout For security reasons, the system automatically logs you out of the system if you do not perform any tasks for a period of time. By default, the system does not log you out until 30 minutes have elapsed without any activity. When you are ready to resume working with the system, click any button on the screen. The system automatically loads the log in page for you. You can also close the web browser windows and re-load the log in page manually in a new browser window.

3.3 Managing Your Password When you are first given access to the system, your administrator will provide you with a password. For security reasons, you should change this password to another one that only you know. Ensure that you choose a password that is easy for you to remember, but difficult for another person to guess. You can change your password at any time. It is a good idea to change your password occasionally.

Page 10: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 10

Changing Your Password

To change your password:

1. Click the Reset PassWord link (see highlighted item 1, on Figure 2 below) that appears at the top right of your screen whenever you are logged in to the system.

2. On the Reset PassWord screen, click on the Change Password button (see highlighted item 2, on Figure 2 below). This is available for Executor and viewer.

3. In the Change Password dialog box which appears, type your new password in the New Password box, and again in the Confirm Password box.

4. Click the Save button. If you forget your password, you must contact your system administrator, who will reset it to a value which you can use temporarily. You should then log in to the system, and change the password to another value of your own choosing, according to the procedure described above.

3.4 The User Menu 3.4 ) The Menu Bar :

1) Log In Menu 2) Open MS Access Data Base File 3) Save the Data 4) Exit from the Enterprise Data management 5) Data Control 6) Search the data 7) Help

Figure 2: The Menu Tab Screen

Tip

System passwords must be at least 6 characters long and contain at least 1 numeric character.

1 2

3

4

5 6

7

Page 11: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 11

1) Opening a MS Access Data Base

2) Showing Loaded Tables in Data Base

Moving between the Data Records :

1

1

Page 12: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 12

1

3) Add , Delete and Watch Data a) Add New Data

Page 13: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 13

Delete Data

Page 14: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 14

After Delete or Adding More Data in the data Base The Enterprise Data Manager will ask for Whether we want to save the changes or not .

Page 15: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 15

Search Data

a) Using SQL Select Query .

Query Based on ID

Page 16: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 16

3.5 Logging Out of the System When you are finished working with the system, you should always log out of the system When you log out, the system performs several ‘clean-up’ procedures, and then automatically returns the application to the Login screen. To log out:

1. Click the Logout link in the Menu area (), in the top right hand area of the screen.

2. Close the browser window.

3.6 Code Listing of the Project :

a) Checking User Access

Private Sub OK_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Me.Close() If PasswordTextBox.Text = "pass" AndAlso UsernameTextBox.Text = "myUser" Then My.Forms.MainFrm.Show() Else MsgBox( "Login Failed " ) End If End Sub

Page 17: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 17

b) Welcome Screen Code Listing :

Private Sub SplashScreen1_Load( ByVal sender As Object , ByVal e As System.EventArgs) Handles Me.Load 'Set up the dialog text at runtime according to the application's assembly information. 'TODO: Customize the application's assembly information in the "Application" pane of the project ' properties dialog (under the "Project" menu). 'Application title If My.Application.Info.Title <> "" Then ApplicationTitle.Text = My.Application.Info.Title Else 'If the application title is missing, use the application name, without the extension ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) End If

Page 18: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 18

'Format the version information using the text set into the Version control at design time as the ' formatting string. This allows for effective localization if desired. ' Build and revision information could be included by using the following code and changing the ' Version control's designtime text to "Version {0}.{1:00}.{2}.{3}" or something similar. See ' String.Format() in Help for more information. ' ' Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision) Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor) 'Copyright info Copyright.Text = My.Application.Info.Copyright End Sub

Page 19: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 19

c) Help & About Box

About Box Code Listing :

Private Sub AboutBox1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Set the title of the form. Dim ApplicationTitle As String If My.Application.Info.Title <> "" Then ApplicationTitle = My.Application.Info.Title Else

Page 20: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 20

ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName) End If Me.Text = String .Format( "About {0}" , ApplicationTitle) ' Initialize all of the text displayed on the About Box. ' TODO: Customize the application's assembly information in the "Application" pane of the project ' properties dialog (under the "Project" menu). Me.LabelProductName.Text = My.Application.Info.ProductName Me.LabelVersion.Text = String .Format( "Version {0}" , My.Application.Info.Version.ToString) Me.LabelCopyright.Text = My.Application.Info.Copyright Me.LabelCompanyName.Text = My.Application.Info.CompanyName Me.TextBoxDescription.Text = My.Application.Info.Description

End Sub

Search Menu Code Listing

#Region "Menu Search Click" 'Search Menu is clicked Private Sub menuSearchClick()

Page 21: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 21

'Create a new instance of the search form 'Specifying the datasource and table to view Dim sfrm = New EnterpriseDataManager.searchfrm( Me, dataSourceFile, "[" + comboTables.Text + "]" , "Select * From [" + comboTables.Text + " ]" ) ' Create a new dataset to hold the changes that have been made to the main dataset. Dim objDataSetChanges As New DataSet() ' Stop any current edits. Me.BindingContext(accessDataSet, comboTables.Text).EndCurrentEdit() ' Get the changes that have been made to the main dataset. objDataSetChanges = CType(accessDataSet.GetChanges(), DataSet) ' Check to see if any changes have been made. If Not (objDataSetChanges Is Nothing ) Then 'alert the user that in order to view the same data 'in the search he/she has to save the file Dim r As DialogResult = MessageBox.Show( "The database file changed, in oder to see your changes in the search

Page 22: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 22

form you have to save, continue any way?" , "Change In Data File Detected" , MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) If r = DialogResult.No Then Return End If End If Form.ActiveForm.Enabled = False sfrm.Show() End Sub 'menuSearchClick #End Region

Loading Data

#Region "LoadData" 'Here data is read from the database 'and all the parameters are set 'Select string is the SQL command required 'to view the data Public Sub LoadData( ByVal SelectString As String ) Me.Cursor = Cursors.WaitCursor Me.Text = "Enterprise Data Manager : Loading Data Please Wait..." Try accessDataSet = New DataSet() Dim accessDataTable As DataTable

Page 23: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 23

'create new instances for select, insert and update 'and delete commands to be used with the adapter Dim accessSelectCommand As New OleDbCommand() Dim accessInsertCommand As New OleDbCommand() Dim accessUpdateCommand As New OleDbCommand() Dim accessDeleteCommand As New OleDbCommand() accessDataAdapter = Nothing accessDataAdapter = New OleDbDataAdapter() accessSelectCommand.CommandText = SelectString accessSelectCommand.Connection = accessConnection accessDataAdapter.SelectCommand = accessSelectCommand ' Attempt to fill the dataset through the accessDataAdapter accessDataAdapter.TableMappings.AddRange( New System.Data.Common.DataTableMapping() { New

Page 24: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 24

System.Data.Common.DataTableMapping( "Table", comboTables.Text)}) 'populate the DataSet with existing constraints information from a data source accessDataAdapter.FillSchema(accessDataSet, SchemaType.Source, comboTables.Text) ' Fill the dataser accessDataAdapter.Fill(accessDataSet) 'create an instance for a datatable accessDataTable = accessDataSet.Tables(comboTables.Text) ' Make dynamic Insert Commands and Parameters accessInsertCommand.Connection = accessConnection make_Insert_Command(accessDataTable, accessInsertCommand) accessDataAdapter.InsertCommand = accessInsertCommand ' The dynamic Update Commands and Parameters

Page 25: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 25

accessUpdateCommand.Connection = accessConnection make_Update_Command(accessDataTable, accessUpdateCommand) accessDataAdapter.UpdateCommand = accessUpdateCommand ' The dynamic Delete Commands and Parameters accessDeleteCommand.Connection = accessConnection make_Delete_Command(accessDataTable, accessDeleteCommand) accessDataAdapter.DeleteCommand = accessDeleteCommand ' Dynamic Controls Postions Dim controlTop As Integer = 10 Dim controlLeft As Integer = 10 'Get all the System.DataTypes of all the 'columns in the table and assign them to the 'array colType

Page 26: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 26

colType = New String (accessDataTable.Columns.Count) {} 'Here AutoMenu is created which would allow the user 'to insert automatic incrementation of numbers (+1 on the 'last cell) or insert today's date for datetime type 'columns AutoMenu = New ContextMenu(accessDataTable.Columns.Count) {} 'Create dynamically all the textboxes and labels 'which will hold and link information to the database 'making it easier to input data Dim i As Integer For i = 0 To accessDataTable.Columns.Count - 1 colType(i) = accessDataTable.Columns(i).DataType.ToString() 'Create the control (Label) Dim LabelControl As Label = CType(CreateControls.MakeControl( "Label" , 30, 100, controlLeft, controlTop + 3,

Page 27: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 27

accessDataTable.Columns(i).Caption + " :" , "cLabel" + i.ToString()), Label) 'Create the control (TextBox) Dim TextControl As TextBox = CType(CreateControls.MakeControl( "TextBox" , 30, 100, controlLeft + 100, controlTop, accessDataTable.Columns(i).Caption, "cText" + i.ToString()), TextBox) 'Assign the TabIndex sequentially to the created 'textbox control TextControl.TabIndex = i 'Bind the textbox control to the database table column TextControl.DataBindings.Add( New System.Windows.Forms.Binding( "Text" , Me.accessDataSet, comboTables.Text + "." + accessDataSet.Tables(comboTables.Text).Columns(i).ToString())) 'Finally add the controls to the form Me.Controls.Add(TextControl) Me.Controls.Add(LabelControl)

Page 28: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 28

'Here we arrange the controls on the form If i = accessDataTable.Columns.Count - 1 Then Exit For End If If controlLeft = 10 Then controlLeft = 220 Else If controlLeft = 220 And accessDataTable.Columns.Count > 6 Then controlLeft = 430 Me.Width = 680 Else controlTop += LabelControl.Height + 10 controlLeft = 10 End If End If Next i arrange_Controls(controlTop, accessDataTable.Columns.Count) 'Bind the datagrid control to the database table

Page 29: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 29

dGrid.SetDataBinding(accessDataSet, comboTables.Text) 'Create AutoInsertion of Date for only 'DateTime' Type 'columns and 'AutoNumber to only 'Integer' type columns For i = 0 To accessDataTable.Columns.Count - 1 If colType(i) = "System.Int32" Then Dim Item1 As New MenuItem( "Automatic Incrementation" ) AddHandler Item1.Click, AddressOf Me.cMenuClick AutoMenu(i) = New ContextMenu( New MenuItem() {Item1}) Else If colType(i) = "System.DateTime" Then Dim Item1 As New MenuItem( "Automatic Insertion of Today's Date" ) AddHandler Item1.Click, AddressOf Me.cMenuClick AutoMenu(i) = New ContextMenu( New MenuItem() {Item1}) End If End If

Page 30: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 30

Next i 'refresh the database view in the grid DataSet_PositionChanged() ' catch any errors and display them Catch e As System.Data.OleDb.OleDbException MessageBox.Show(e.Message) End Try Me.Cursor = Cursors.Arrow Me.Text = "Enterprise Data Manager" End Sub 'LoadData #End Region

Adding Data /Inserting Data Code Listing

#Region "make_Insert_Command" 'Here the command string and the parameters are 'assigned dynamically for the insert command Private Sub make_Insert_Command( ByVal datatable As DataTable, ByVal insertcommand As OleDbCommand) Dim insertString1 As String = "INSERT INTO [" + comboTables.Text + "] (" Dim insertString2 As String = ""

Page 31: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 31

Dim i As Integer For i = 0 To datatable.Columns.Count - 1 insertString1 += "[" + datatable.Columns(i).Caption + "]" insertString2 += "?" If i <> datatable.Columns.Count - 1 Then insertString1 += "," insertString2 += "," Else insertString1 += ") VALUES (" + insertString2 + ")" End If insertcommand.Parameters.Add( New System.Data.OleDb.OleDbParameter(datatable.Columns(i).Caption, System.Data.OleDb.OleDbType.Variant, 16, datatable.Columns(i).Caption)) Next i insertcommand.CommandText = insertString1 End Sub 'make_Insert_Command #End Region

Update Data Code Listing

#Region "make_Update_Command" 'Here the command string and the parameters are 'assigned for the update command

Page 32: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 32

Private Sub make_Update_Command( ByVal datatable As DataTable, ByVal updatecommand As OleDbCommand) Dim updateString1 As String = "UPDATE [" + comboTables.Text + "] SET " Dim updateString2 As String = "" Dim i As Integer For i = 0 To datatable.Columns.Count - 1 If datatable.Columns(i).AutoIncrement <> True Then updateString1 += "[" + datatable.Columns(i).Caption + "] = ? " If i <> datatable.Columns.Count - 1 Then updateString1 += " , " End If Dim colSQLType As OleDbType = Return_OleDBType(datatable.Columns(i).DataType.ToString()) updatecommand.Parameters.Add( New OleDbParameter(datatable.Columns(i).Caption, colSQLType, 0, datatable.Columns(i).Caption)) End If

Page 33: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 33

updateString2 += "([" + datatable.Columns(i).Caption + "] = ? OR ? IS NULL AND [" + datatable.Columns(i).Caption + "] IS NULL)" If i <> datatable.Columns.Count - 1 Then updateString2 += " AND " Else updateString1 += " WHERE (" + updateString2 + ")" End If Next i For i = 0 To datatable.Columns.Count - 1 Dim colSQLType As OleDbType = Return_OleDBType(datatable.Columns(i).DataType.ToString()) updatecommand.Parameters.Add( New OleDbParameter( "Original_" + datatable.Columns(i).Caption, colSQLType, 0, System.Data.ParameterDirection.Input, False , CType(10, System.Byte), CType(10, System.Byte), datatable.Columns(i).Caption, System.Data.DataRowVersion.Original, Nothing )) updatecommand.Parameters.Add( New OleDbParameter( "Original_" +

Page 34: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 34

datatable.Columns(i).Caption + "1" , colSQLType, 0, System.Data.ParameterDirection.Input, False , CType(10, System.Byte), CType(10, System.Byte), datatable.Columns(i).Caption, System.Data.DataRowVersion.Original, Nothing )) Next i updatecommand.CommandText = updateString1

End Sub 'make_Update_Command

Showing Data in Data Grid Code Listing

#Region "Data Grid's Event" 'Show AutoNumber Incrementation or Automatic Date 'Insertion menu creation routine Private Sub dGrid_MouseDown( ByVal sender As Object , ByVal e As System.Windows.Forms.MouseEventArgs) Handles dGrid.MouseDown 'Runs for right mouse down Dim myGrid As DataGrid = CType(sender, DataGrid) Dim hti As System.Windows.Forms.DataGrid.HitTestInfo hti = myGrid.HitTest(e.X, e.Y)

Page 35: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 35

Select Case hti.Type Case System.Windows.Forms.DataGrid.HitTestType.ColumnHeader If colType(hti.Column) = "System.Int32" Or colType(hti.Column) = "System.DateTime" Then If e.Button <> System.Windows.Forms.MouseButtons.Right Then Return End If AutoMenu(hti.Column).Show(dGrid, New Point(e.X, e.Y)) End If End Select End Sub 'dGrid_MouseDown 'The Grid's update routine if any of the menue's are 'checked Private Sub dGrid_CurrentCellChanged( ByVal sender As Object , ByVal e As System.EventArgs) Handles dGrid.CurrentCellChanged Me.DataSet_PositionChanged() Dim getRow As String () = lblNavLocation.Text.Split( " " ) If getRow(0) <> getRow(3) Then Return

Page 36: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 36

End If Dim myGrid As DataGrid = CType(sender, DataGrid) Dim row As Integer = Convert.ToInt32(getRow(0)) Dim i As Integer For i = 0 To (accessDataSet.Tables(comboTables.Text).Columns.Count) - 1 If colType(i) = "System.Int32" AndAlso AutoMenu(i).MenuItems(0).Checked = True Then If row > 1 Then Try UpdateTextBoxes(i, Convert.ToString(( CInt (dGrid(dGrid.CurrentCell.RowNumber - 1, i)) + 1))) Catch End Try End If End If If colType(i) = "System.DateTime" AndAlso AutoMenu(i).MenuItems(0).Checked = True Then If ( True ) Then UpdateTextBoxes(i, System.DateTime.Now.Date.ToString()) End If End If

Page 37: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 37

Next i End Sub 'dGrid_CurrentCellChanged 'Menu Updates done in the textbox controls 'after editing here Private Sub UpdateTextBoxes( ByVal Col As Integer , ByVal newValue As String ) Dim i As Integer For i = 0 To ( Me.Controls.Count) - 1 If Me.Controls(i).Name = "cText" + Col.ToString() Then If Me.Controls(i).Text <> "" Then Return End If Me.Controls(i).Text = newValue End If Next i End Sub 'UpdateTextBoxes

#End Region

Filter Menu For searching Data (Search Data Form)

#Region "Filter Menu Click Event" 'This routine handles the filter menu click event

Page 38: Enterprise Data Manager in VB.net 2005

Project Report

CopyRight (Harleen ,8) , Chandigarh Tel : Page 38

Private Sub cMenuClick( ByVal sender As Object , ByVal e As System.EventArgs) doUpdate = False Dim tempItem As MenuItem = CType(sender, MenuItem) Dim accessDataTable As DataTable = accessDataSet.Tables(tableName) If accessDataTable.Columns(columnHit).DataType.ToString() = "System.Byte[]" Then MessageBox.Show( "This DataType Cannot Be Filtered" , "Unable To Do Filter" , MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Return End If checkedMenu(columnHit) = tempItem.Text Try loadData(MakeSelectString(checkedMenu)) lblSelectString.Text = "Select Command = " + MakeSelectString(checkedMenu) Catch End Try End Sub 'cMenuClick #End Region

End-of codelisting :