SQL Server 2000 Stored Procedure & XML Programming in .NET

Print DataMatrix in .NET SQL Server 2000 Stored Procedure & XML Programming

SQL Server 2000 Stored Procedure & XML Programming
Data Matrix 2d Barcode Decoder In Visual Studio .NET
Using Barcode Control SDK for .NET Control to generate, create, read, scan barcode image in Visual Studio .NET applications.
Print Data Matrix ECC200 In .NET Framework
Using Barcode drawer for .NET framework Control to generate, create DataMatrix image in VS .NET applications.
The fn_ListExtendedProperty() function is designed to list the extended properties of an object. It requires that you specify objects in the same manner as the stored procedures do. You can see the result set returned by the function in Figure 9-7.
Decode Data Matrix ECC200 In .NET Framework
Using Barcode reader for .NET framework Control to read, scan read, scan image in VS .NET applications.
Barcode Encoder In VS .NET
Using Barcode maker for VS .NET Control to generate, create barcode image in Visual Studio .NET applications.
Figure 9-7
Read Bar Code In VS .NET
Using Barcode recognizer for VS .NET Control to read, scan read, scan image in .NET framework applications.
Data Matrix Creator In Visual C#.NET
Using Barcode generation for .NET framework Control to generate, create Data Matrix 2d barcode image in .NET framework applications.
Extended properties of an object
ECC200 Drawer In VS .NET
Using Barcode maker for ASP.NET Control to generate, create Data Matrix image in ASP.NET applications.
Creating Data Matrix 2d Barcode In Visual Basic .NET
Using Barcode encoder for VS .NET Control to generate, create DataMatrix image in .NET framework applications.
Interaction with the SQL Server Environment
Barcode Printer In VS .NET
Using Barcode generation for .NET framework Control to generate, create bar code image in Visual Studio .NET applications.
USS Code 39 Generation In VS .NET
Using Barcode maker for VS .NET Control to generate, create Code 39 image in Visual Studio .NET applications.
IN THIS CHAPTER:
Create GS1 DataBar Limited In Visual Studio .NET
Using Barcode encoder for .NET Control to generate, create GS1 DataBar image in .NET applications.
Make Rationalized Codabar In Visual Studio .NET
Using Barcode generator for .NET Control to generate, create Code 2 of 7 image in .NET applications.
CHAPTER
Drawing Code 128C In Visual C#.NET
Using Barcode encoder for VS .NET Control to generate, create Code 128C image in VS .NET applications.
Bar Code Creator In VS .NET
Using Barcode generator for Reporting Service Control to generate, create barcode image in Reporting Service applications.
Execution of OLE Automation/COM Objects Running Programs Running Windows Script Files Running/Looping Through DTS Packages Interacting with the NT Registry Jobs SQL Server and the Web E-Mail Security
Make USS Code 128 In None
Using Barcode generator for Online Control to generate, create Code 128C image in Online applications.
Drawing Data Matrix 2d Barcode In None
Using Barcode printer for Word Control to generate, create Data Matrix ECC200 image in Word applications.
SQL Server 2000 Stored Procedure & XML Programming
Print ECC200 In VS .NET
Using Barcode maker for ASP.NET Control to generate, create ECC200 image in ASP.NET applications.
Barcode Creator In Java
Using Barcode encoder for Android Control to generate, create barcode image in Android applications.
his chapter focuses on the ways you can use system and extended stored procedures to interact with the SQL Server environment. It also discusses the ways user-defined stored procedures can help you leverage the existing functionality of elements within the SQL Server environment. By the end of this chapter, you will be able to do the following: Use OLE Automation in Transact-SQL Run programs and operating system commands from the command shell Execute DTS packages Implement looping in DTS packages Manage jobs in Job Scheduler Read and write Registry entries Use the e-mail capabilities of SQL Server to notify users of events on the server Use the e-mail capabilities of SQL Server to send queries, process them, and receive result sets Publish the contents of the database on the Web Perform administration tasks with stored procedures Manage application security
Creating EAN-13 In None
Using Barcode generator for Font Control to generate, create EAN-13 image in Font applications.
Bar Code Generator In .NET
Using Barcode generation for Reporting Service Control to generate, create bar code image in Reporting Service applications.
Execution of OLE Automation/COM Objects
Microsoft has developed several technologies that enable developers to encapsulate code and custom objects into executable components. These components can then be invoked by other applications developed in the same (or any other) programming language that supports these kinds of components. Through the years, this technology has been known by different names: OLE, OLE Automation, COM, DCOM, Automation, ActiveX, COM+ and the saga continues. SQL Server can initiate code components and access the properties and methods exposed by them. A set of system stored procedures (with the prefix sp_OA) has been designed and implemented in SQL Server to help you accomplish such tasks.
NOTE
When Microsoft first unveiled this feature in SQL Server, code components were known as OLE Automation objects. For this reason, Microsoft attached the OA prefix to these stored procedure names, and I used OLE Automation Objects in the title of the section.
10: Interaction with the SQL Server Environment
To demonstrate the use of OLE Automation on a simple Visual Basic function:
1. Create the DjnToolkit ActiveX DLL project in Visual Basic and then create a
DjnTools class.
2. Create a method called SpellNumber, which ignores the input value (currency
amount) and returns a constant string (see Figure 10-1).
NOTE
Even if you run the object from the Visual Basic IDE (instead of compiling and installing it), you will still be able to access it from Transact-SQL code. This is an important feature for debugging the object.
The stored procedure shown in the code on the following page first initiates the COM object using the sp_OACreate system stored procedure. It obtains a token @intObject, which is used from that point to access the class.
Figure 10-1
A COM object created in Visual Basic
SQL Server 2000 Stored Procedure & XML Programming
The sp_OAMethod stored procedure is used to execute class methods. The return value and input parameter of the method are placed at the end of the stored procedure s parameter list. Before the stored procedure is complete, the COM object must be destroyed using sp_OADestroy. If an automation error occurs at any point, sp_OAGetErrorInfo can be used to obtain the source and description of the most recent error:
Alter Procedure prSpellNumber -- demo of use of Automation objects @mnsAmount money, @chvAmount varchar(500) output, @debug int = 0 As set nocount on Declare @intErrorCode int, @intObject int, -- hold object token @bitObjectCreated bit, @chvSource varchar(255), @chvDesc varchar(255) Select @intErrorCode = @@Error If @intErrorCode = 0 exec @intErrorCode = sp_OACreate 'DjnToolkit.DjnTools', @intObject OUTPUT If @intErrorCode = 0 Set @bitObjectCreated = 1 else Set @bitObjectCreated = 0 If @intErrorCode = 0 exec @intErrorCode = sp_OAMethod @intObject, 'SpellNumber', @chvAmount OUTPUT, @mnsAmount If @intErrorCode <> 0 begin
Copyright © OnBarcode.com . All rights reserved.