Files
2025-11-26 11:18:26 +08:00

36 lines
904 B
C#

using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DB_Server
{
internal class DBLib
{
#region ConvertParameters转换参数类型
public static T[] ConvertParameters<T>(DbParameter[] commandParameters)where T : DbParameter ,new ()
{
if (commandParameters == null)
return null;
T [] _SqlParameters = new T [commandParameters.Length];
for (int i = 0; i < commandParameters.Length; i++)
{
_SqlParameters[i] = new T() {
ParameterName = commandParameters[i].ParameterName,
Value = commandParameters[i].Value,
};
}
return _SqlParameters;
}
#endregion
}
}