public static void AppendINStatement(DbCommand command, string InStatementRegion, string[] Parameters, string paramName = null) { if (paramName == null) { paramName = InStatementRegion.Trim('$'); } string InStatement = CSV2Core.Support.SQLSupport.GenerateInStatement(Parameters, paramName); command.CommandText = command.CommandText.Replace(InStatementRegion, InStatement); for (int i = 0; i < Parameters.Length; i++) { DBSQLSupport.SetParameter(command, paramName + (i), Parameters[i]); } }
/// <summary> /// General function for setting the parameters /// </summary> /// <param name="command">The created database command</param> /// <param name="name">The name of the parameter</param> /// <param name="value">The value of the parameter</param> public static void SetParameter(DbCommand command, string name, object value) { var sqlCommand = (MySqlCommand)command; Type parameterType = (value == null ? null : value.GetType()); //Set standard parameters if (value is Guid) { DBSQLSupport.Guid_SetParameter(sqlCommand, name, (Guid)value); } else if (value is SessionSecurityTicket) { DBSQLSupport.Ticket_SetParameter(sqlCommand, name, value as SessionSecurityTicket); } else { DBSQLSupport.Standard_SetParameter(sqlCommand, name, value); } }