stevegray
4Penny.net
Points: 55509

11/23/2021 11:51:06 AM

SQL data access from .NET with one line of code

* This article, and all our great .NET Development documentation, Is available on the .NET Development menu

Wouldn't you like to be able to call a stored procedure from .NET with one line of code? 

The classes below show how to make this happen. Look at how easy it is to use!

Note:

Every experienced developer has code like this in their library. So, if this this is you, I challenge you to provide code that meets these criteria:

  • Easier to use than mine
  • Is designed for an entry level coder. In order to do this, I stripped out all the 'embellishments' that I have in my library code, with the aim of getting data access done QUICKLY. Quick is the word, and the code below is quick.

 

Public Class UsageExample
    Sub Main()
 
        'This is an example of calling a stored procedure with one line of code.
        'in order to make this work, copy the following three classes into your code, then call them as you see below.
 
        'this will execute a stored procedure
        QuickDataAccess.dd_MyStoredProcedure("123", "GPSQL", "TWO").execute()
 
        'this will call a stored procedure and return a dataset
        Dim oDT As DataTable = QuickDataAccess.dd_MyStoredProcedure("123", "GPSQL", "TWO").getTable
 
    End Sub
End Class
4Penny.net
Version: Unknown or N/A
Section: .NET Development
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3