CodeSmith Community
Your Code. Your Way. Faster!

HOWTO: Create VB .NET Stored Procedure Wrapper

rated by 0 users
This post has 1 Reply | 1 Follower

Not Ranked
Posts 1
Points 35
SQL Samurai Posted: 07-19-2007 10:31 AM

Hi. I am evaluating your software and I must say that it looks like an awesome product!

I've played with a few of the templates, namely AllCommandWrappers and CommandWrapperClass. What I want to be able to do is create a wrapper class for all my stored procedures. I would like them to all be in one class and in one file. I noticed when I ran the ALLCommandWrappers it created a separate file for each stored procedure.

I've also noticed that these templates are in C# and I'm more of a VB .NET kind of guy. Do they offer VB .NET versions of these templates?

I've included a little sample of what I would like my class to look like. Big Smile

 Public Class DataAccessLayer

Public Shared ConnectionString As String = System.Configuration.ConfigurationSettings.AppSettings.Get("ConnectionString")


Public Shared Function STIGetDifferentLumberTypes(ByVal @PurchaseOrderID As Integer, ByVal @ProductionID As Integer, ByVal @ReturnID As Integer, ByVal @TransactionID As Integer) As DataView
'Retrieve the parameter set
Dim storedParams() As SqlParameter = New SqlParameter(3) {}
storedParams = SqlHelperParameterCache.GetSpParameterSet(ConnectionString ,"STIGetDifferentLumberTypes")

storedParams(0).Value = @PurchaseOrderID
storedParams(1).Value = @ProductionID
storedParams(2).Value = @ReturnID
storedParams(3).Value = @TransactionID

Dim ds As DataSet

ds = SqlHelper.ExecuteDataset(ConnectionString,CommandType.StoredProcedure,"STIGetDifferentLumberTypes", storedParams)

Return ds.Tables(0).DefaultView
End Function

...

End Class

Thanks for your help!

  • | Post Points: 35
Top 50 Contributor
Posts 100
Points 80,345

Currently, there is only the C# version of the CommandWrapper.  I do think you could convert the CommandWrapperClassTemplate.cst to vb rather quickly and get the functionality you want.

  • | Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems