Last active
August 29, 2015 14:17
-
-
Save pocketkk/8acf92d80b69433daa51 to your computer and use it in GitHub Desktop.
AddParamsFromList_GetParamsFromString
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Function AddParamsFromList_GetParamsString(ByVal valuesList As List(Of String), ByVal columnName As String, ByRef sqlCommand As SqlCommand) As String | |
If Not valuesList.Count > 0 Then | |
Throw New Exception(String.Format("Invalid Argument: List is empty")) | |
End If | |
Dim _returnParamString As String = "" | |
For i As Integer = 0 To valuesList.Count - 1 | |
Dim _paramName As String = String.Format("@{0}{1}", columnName, i) | |
sqlCommand.Parameters.AddWithValue(_paramName, valuesList(i)) | |
_returnParamString += _paramName + "," | |
Next | |
Return _returnParamString.Trim(",") | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment