Exforsys

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor

Ads


Home arrow Technical Training arrow VB.NET 2005

SQL Server Ad Hoc Queries Page - 2

Page 2 of 2
Author : Exforsys Inc.     Published on: 9th Jul 2005    |   Last Updated on: 24th Dec 2007

SQL Server Ad Hoc Queries

.

.

Ads

Now press F5 to execute the program. You will see the form like the screenshot below:

Enter a product category and press Insert. The console window will appear and show all the products including the one just inserted. The display will be like the one in the screenshot below.

The UPDATE Statement

UPDATES may be required whenever an user commits an error or wishes to enter data in a field where data was omitted to be entered or wishes to merely change the value of a field. Let us assume that the value “ship” was wrongly entered in place of “Maritime Equipments”. Now the user wishes to update this field with the correct information. Let us work out this example and learn how we can do this.

1.2.The window will look like the screenshot shown below:

To update the field the user will create a code as below:

Click here to view sample code

Note that this code is similar to the code we wrote for INSERT. The difference being that we use the UPDATE command instead of the INSERT command in the code.

Caution: Please note that using a column like name which can contain duplicates will cause more rows than you originally intended to be deleted or updated.

The output for the program in the Quick Console is shown below. Please note that ProductCategory Name for ID No: 5, has been changed to Maritime Equipments.

The DELETE Statement

Sometimes data entry errors can occur due to entry of duplicate values or completely wrong entries. The user will need to delete such entries. The DELETE command is used for this purpose. In the illustration above, we added Maritime Equipments as a product category. Now we find that we do not need this category. We shall use the DELETE statement to delete the category. However, it should be noted that if there are other constraints it may be difficult to delete a particular item, row or column.

  • Create a new Windows Application in Visual Basic Express 2005 Beta2 IDE and
  • Add two labels, a TextBox and two Command Buttons as shown below:

Ads

The user will have to replace the UPDATE statement of the previous code with the DELETE statement in the code. Now press F5 to execute the program. In the window that pops up, enter the category name that you want to delete. Please note that using a column like name which can contain duplicates, will cause more rows than you originally intended, to be deleted or updated. The Quick Console will show that the row has been deleted:

Tip: Before proceeding any further new users to VB.NET may bear in mind that Namespaces especially SystemData are not referenced by default. The user must add reference to these namespaces in order to avoid errors. The examples in this tutorial are based on ADVENTUREWORKS_DATA.mdf. This can be downloaded from Microsoft.com. If the user wishes to use any other database he can do so by changing the connect string value and also modify the SQL queries in accordance with his needs.

The SELECT Statement



 
This tutorial is part of a VB.NET 2005 tutorial series. Read it from the beginning and learn yourself.

VB.NET 2005

  1. VB.NET 2005 Free Training
  2. The .NET Framework Architecture Part 1
  3. The .NET Framework Architecture Part 2
  4. Application Class and Message Class
  5. Implementing Class Library Object
  6. Visual Studio.NET Namespaces
  7. .NET Assemblies
  8. Differences between VB.NET 1.0 and VB.NET 2.0
  9. Introducing VB.NET Windows Forms
  10. Visual Studio Windows Forms Designer
  11. Exploring the Forms Designer generated code
  12. Setting and Adding Properties to Windows Form
  13. Implementing Inheritance
  14. Event Handling In Visual Basic .NET
  15. Building Graphical Interface elements
  16. .NET Common Windows Forms Controls Part 1
  17. .NET Common Windows Forms Controls Part 2
  18. Common Controls and Handling Control Events
  19. DomainUpDown and NumericUpDown Controls
  20. Dialog Boxes in Visual Basic .NET
  21. Visual Studio Adding Controls to Windows Form
  22. VB.NET Validation Controls
  23. Working with Menu Controls
  24. VB.NET MDI Applications
  25. .NET Exceptions
  26. VB.NET Creating and Managing Components Part 1
  27. VB.NET Creating and Managing Components Part 2
  28. Simple Data Binding
  29. .NET Complex Data Binding
  30. .NET Data Form Wizard
  31. Data Manipulation with ADO.NET
  32. SQL Server Stored Procedures
  33. SQL Server Ad Hoc Queries
  34. Finding and Sorting Data in DataSets
  35. ADO.NET Object Model
  36. Working with DataSets
  37. Using XML Data
  38. Working with File System in .NET
  39. Creating Web Service
  40. Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
  41. Web Reference and Web Services
  42. Web Services - SOAP, WSDL, Disco and UDDI
  43. Web Application Testing in VB.NET 2005
  44. Web Application Tracing and Debugging
  45. Working with Legacy Code and COM Components
  46. ActiveX Controls and Legacy Code
  47. Windows Application Testing
  48. VB.NET Windows Application Testing
  49. Tracing VB.NET Windows Application
  50. Debugging Windows Applications In Visual Studio.NET 2005
  51. Deploying Windows Applications In Visual Studio.NET 2005
  52. Customizing Setup Project in Visual Studio.NET 2005
  53. Shared Assembly
  54. Microsoft .NET Creating Installation Components
  55. The Registry Editor in Visual Studio.NET 2005
  56. The File Types Editor
 

Comments