You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
795 B
27 lines
795 B
3 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Data.SqlClient;
|
||
|
using System.Linq;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
|
||
|
namespace BiskLog_Point_Of_Sale.Classes
|
||
|
{
|
||
|
public static class distinctive
|
||
|
{
|
||
|
public static void AddParametersWithValues1<T>(this SqlCommand cmd, string parameterName, params T[] values)
|
||
|
{
|
||
|
var parameterNames = new List<string>();
|
||
|
for (int i = 0; i < values.Count(); i++)
|
||
|
{
|
||
|
var paramName = @"@distinctive" + i;
|
||
|
cmd.Parameters.AddWithValue(paramName, values.ElementAt(i));
|
||
|
parameterNames.Add(paramName);
|
||
|
}
|
||
|
|
||
|
cmd.CommandText = cmd.CommandText.Replace(parameterName, string.Join(",", parameterNames));
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|