B
BobRoyAce
I have a class that has several Subs that do DB things, some of which
require the same set of parameters to be passed to a stored procedure.
One class has 12 parameters and part of code used to create them is
shown below:
Dim SQLParam(12) As SqlClient.SqlParameter
SQLParam(0) = New System.Data.SqlClient.SqlParameter
With SQLParam(0)
.ParameterName = "@pkUserIDOriginal"
.DbType = DbType.Int32
.Direction = ParameterDirection.Input
.Value = _pkUserID
End With
..
..
..
I then pass this array of SqlClient.SqlParameter objects to the command
to execute the stored procedure. Well, my question is "How do I create
a function that returns this array that I could call from all Subs that
need it (rather than having the same code in multiple places)?"
require the same set of parameters to be passed to a stored procedure.
One class has 12 parameters and part of code used to create them is
shown below:
Dim SQLParam(12) As SqlClient.SqlParameter
SQLParam(0) = New System.Data.SqlClient.SqlParameter
With SQLParam(0)
.ParameterName = "@pkUserIDOriginal"
.DbType = DbType.Int32
.Direction = ParameterDirection.Input
.Value = _pkUserID
End With
..
..
..
I then pass this array of SqlClient.SqlParameter objects to the command
to execute the stored procedure. Well, my question is "How do I create
a function that returns this array that I could call from all Subs that
need it (rather than having the same code in multiple places)?"