MS SQL Server
  Home arrow MS SQL Server arrow Page 2 - Developing Managed Code and Executing With...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
MS SQL SERVER

Developing Managed Code and Executing Within Microsoft SQL Server 2000
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 11
    2005-12-15

    Table of Contents:
  • Developing Managed Code and Executing Within Microsoft SQL Server 2000
  • Developing the .NET component
  • How to deploy the .NET component
  • How to call .NET component from within SQL Server 2000
  • Understanding the concept

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Developing Managed Code and Executing Within Microsoft SQL Server 2000 - Developing the .NET component


    (Page 2 of 5 )

    Since this is a very simple demonstration, I will try to create a simple .NET component with only one method, which accepts two integer values as parameters and returns their sum.

    You can start opening your Visual Studio and proceed through the following steps:

    • Go to File -> New -> Project.
    • Select “Class Library” as the Project Template and specify the “Name” of the project as “MySample”.  You will be presented with a default class, “Class1.”
    • Within the “Solution Explorer”, right click on “Class1” and delete it.
    • Again within the “Solution Explorer”, right click on the project, go to Add -> Add Class.
    • Give the name of the class as “ISample” and modify the code as follows:

     Public Interface ISample

        Function getSum(ByVal a As Integer, ByVal b As Integer) As Integer
    End Interface
    • Again within the “Solution Explorer”, right click on the project, go to Add -> Add Class.
    • Give the name of the class as “CSample” and modify the code as follows:

    Public Class CSample

        Implements ISample
     
        Public Function getSum(ByVal a As Integer, ByVal b As Integer) As Integer Implements ISample.getSum
            Return a + b
        End Function
     
    End Class
    • Again within the “Solution Explorer”, double click on “AssemblyInfo.vb” and add the following line at the bottom

     

    <Assembly: AssemblyKeyFile("..\..\MySample.snk")>
    • Go to Start -> Programs -> Microsoft Visual Studio.NET 2003 -> Visual Studio.NET tools -> Visual Studio.NET 2003 Command Prompt.
    • Go to the path of your project folder (which is “MySample”), using the Command Prompt.
    • Type the following command to provide a strong name to the component.  The strong name key pair is necessary for registering the component with GAC cache.

     

    Snk MySample.snk
    • Now build your solution by pressing Ctrl+Shift+B.  It should complete successfully.  If you receive any errors, doublecheck the path of “MySample.snk”.  It should be available in the same project folder (and not in “bin” or any other sub folder).

    More MS SQL Server Articles
    More By Jagadish Chaterjee


       · Databases can be difficult to deal with; I hope you found this article on developing...
     

    MS SQL SERVER ARTICLES

    - Completing the Introduction to Transact-SQL
    - A Brief Introduction to Transact-SQL
    - Lookups and Blocking Bad Data
    - Field Validation Rules for Blocking Bad Data
    - Using Masks to Block Bad Data
    - Blocking Bad Data
    - Using @@ROWCOUNT and TABLE Variables for Dat...
    - How to Use Variables, IF and CASE in Databas...
    - Creating Important Aspects of Notification S...
    - Working wth Variables in Database Interactio...
    - Delving Deeper into Notification Services
    - Notification Services
    - Building a Multi-table Report with SQL 2005 ...
    - A Secure Way of Building Connection Strings
    - Transferring a Database Using the SSIS Desig...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway